High order finite difference method for time-space fractional differential equations with Caputo and Riemann-Liouville derivatives