Solution for Code Chef Problem 'TSORT' (http://www.codechef.com/problems/TSORT)