Let the speed of both trains be V km/h and (V + 6) km/h, respectively
Then, according to the question.
160 = V x 4 + (V + 6) x 4
⇒ 160 = 4V + 4V + 24
⇒ 40 = V + V + 6
⇒ 2V + 6 = 40
⇒ 2V = 34
∴ V = 17
Hence, speeds of both the trains are 17 km/h and (17 + 6 ) km/h i,e 17 km/h and 23 km/h .