At the same time but different speeds, two trains X and Y left from different stations, A and B, and moved facing each other (to opposite directions). They first met at the point that was 120 miles from station A. When X and Y reached the destinations (B and A respectively), they moved back without stop. 6 hours later after they first met, two trains met again. This time, the meeting point was 90 miles from station A. Suppose each of them was moving all the time at a constant rate, what were the speeds of train X and Y (X and Y had different rate)?

v(X)=v1

v(Y) = v2
s is the distance between A and B
t is the time before the 1st meeting

v1•t=120,
v2•t=s-120,
{(s-120)+(s-90)} =v1•6,
v2•6=120+90.
=> v2=(120+90)/6=210/6=35 mph
-----
t=120/v1 (1)
2s-210=6•v1 (2)
35•t=s-120 (3)
===
Substitute (1) in (2)
35•120/v1=s-120 (4)
From(3)
s= 3•v1+105 (5)
Plug (5) in (4)
v1² - 5•v1- 35•40=0
v1= 40 mph