Suppose, on the $x$-axis, a body $A$ is moving with velocity $v_1$ and acceleration $a_1$, and a second body $B$ is moving with velocity $v_2$ and acceleration $a_2$. $B$ is at a distance of $S$ from $A$ ($v_1 \gt v_2$ and $a_2 \gt a_1$).
Can we use relative motion to find time here that when they will meet? [$A$ and $B$ are non-inertial frames, so how can we apply relative motion here?]