Solved Sort Three Tuple problem