Implemented inorder tree traversal for Q1