ONE DAY
rate time distance
x 24/x 24
y 40/y 40
Total 9
NEXT DAY
rate time distance
x 18/x 18
y 48/y 48
Total 9
The time expressions are filled according to ;
.
The two time sum relationships for the two days give the system
You can solve that system, ... unless you need help with the algebra or arithmetic steps.
---
Many long steps on paper; but found x=6 and y=8.