Let length of faster train = $L_1$ m, length of slower train = $L_2$ m.
When moving in opposite directions: Relative speed = $(60 + 50)$ km/h $= 110$ km/h. Convert to m/s: $\frac{110 \times 1000}{3600} = \frac{1100}{3.6} \approx 30.5556$ m/s.
They cross each other in 5 s, so:
\[
\frac{L_1 + L_2}{30.5556} = 5 \Rightarrow L_1 + L_2 = 152.778.
\]
When moving in same direction (faster overtaking slower): Relative speed = $(60 - 50)$ km/h = $10$ km/h = $\frac{10000}{3600} \approx 2.7778$ m/s.
They cross in 18 s, so the faster train length =
\[
\frac{L_1}{2.7778} = 18 \Rightarrow L_1 \approx 50 \text{ m}.
\]
Wait — here the overtaking time includes only $L_2$ if passenger is in faster train? Actually, in same-direction overtaking from inside faster train, passenger must cover the length of the slower train, so:
\[
\frac{L_2}{2.7778} = 18 \Rightarrow L_2 \approx 50 \text{ m}.
\]
Then from $L_1 + L_2 \approx 152.778$, $L_1 \approx 102.778$ m.
Thus, lengths $\approx 102.78$ m and $55$ m match the closest option (D).