Let the speed of Bus A be x km/hr and speed of Bus B be y km/hr.
Let the distance from Q when they meet moving in same direction be d km.
Both of them travel for 5 hours before they meet.
Hence, the distance travelled by Bus A = 5 x km. = 100 + d
The distance travelled by Bus B = 5 y km = d.
→ 5x = 100 + 5y or x = 20 + y ...(i)
Moving in opposite direction, they meet after 1 hour.
Distance travelled by Bus A = 1x = x km.
Distance travelled by Bus B = 1y = y km.
But it can be seen that x + y = 100 km...(2)
Solving (i) and (2),
x = 20 + y = 20 + 100 - x or
2x = 120
→ x = 60 km/hr
and y = 100 - x = 100 - 60 = 40 km/hr.