Construct a tree as in question 1. Then invert the tree i.e. for each node left chile becomes the right child and right child becomes the left child. Dio not construct a new tree, this has to be done in-place i.e. in the same constructed tree.
Input Format:
First line of input contains an integer n i.e. number of nodes. Second line contains n space separate integers.
Output Format:
After inversion, print the tree in inorder, preorder and postorder fashion. Print a newline after each traversal.
Constraints:
All the numbers are well with in the integer range.
Constructed Tree:
1
\
4
/ \
4 5
\
6
Tree after inversion:
1
/
4
/ \
5 4
/
6