The objects A, B, C move with regard to each other. After time t after the objects started moving, the distance between A and B (yellow) was The distance between B and C was (light blue), it is negative because C has lower velocity than B (C has less incline). And the distance between A and C was (blue) for the same reason. Therefore, from the drawing we have
Now substitute what these distances are in terms of relative velocities: