After covering a distance of 30km. With a uniform speed there is some

After covering a distance of 30km. With a uniform speed, there is some defect in a train engine and therefore its speed is reduced to 4/5 of its original speed consequently the train reaches its destination late by 45 minutes had it happened after covering 18 km. More the train would have reached 9 minutes earlier find the speed of train and distance of the journey

Let,
the speed of the train = x km/hr
the total distance covered by the train = y km
image
According to the first condition, we get
Time taken at original speed + time taken at reduced speed = original time taken + 45 minutes
image
According to the second condition, we get
image