Two trains, each of length 100 m, moving in opposite directions along parallel lines, meet each other with speeds of 50 km/h and 40 km/h. If their accelerations are 30 cm/s^2 and 20 cm/s^2, respectively, find the time they will take to pass each other.