Implemented Utopian Tree solution