What have you tried?

I assume that you know the kinematic equations.

For each of the particles you are given the initial position

Their initial velocity and their acceleration .

Hint: for simplicity since Z is arbitrary and you are only care about distance from z you might as well put the origin of your coordinate system at z and so .

Now write out each of the kinematic equations you will get a system of 2 equations in x and t.