SPOJ To and Fro