A train P leaves Bareilly at 5 am and reaches Dehradun at 9 am. Another train Q leaves Dehradun at 7