For this Question: Given a binary tree with root 1. You have to make some other node as the root such that all conditions of a binary tree is satisfied. Print all nodes other than 1 that can be made as the root of the tree in sorted order.
Note - You cannot add/remove a node. You cannot break any edge.First line contains the integer N, denoting the number of nodes in the binary tree.
Next N lines contains two integers denoting the left and right child of the i'th node respectively. 
If the node doesn't have a left or right child, it is denoted by '-1'

1 <= N <= 100000Print in a single line all nodes other than 1 that can be made as the root. You must print in increasing order.Sample Input 1:
5
2 4
5 -1
-1 -1
-1 3
-1 -1
Sample output 1:
2 3 4 5

Explanation: Given binary tree 
                1
               /  \
             2     4
            /        \
          5           3
One possible configuration of tree when 4 is made as the root
                4
               /  \
             1     3
            /      
           2 
         / 
        5  , I have written this Solution Code: 
n=int(input())
A=[]
for i in range(1,n+1):
	u,v=[int(x) for x in input().split()]
	if(u==-1 or v== -1):
		A.append(i)
A.sort()
for x in A:
	print(x,end=" "), In this Programming Language: Python, Now tell me if this Code is compilable or not?