changed List to Pair. changed Pair data structure from List to Tree.