For this Question: You are given a binary tree rooted at 1. You have to find the mirror image of any node qi about node 1. If it doesn't exist then print -1. Consider the mirror to be a vertical plane at node 1.

Node 1 is considered to be a mirror image of itself.First line contains the integer N and Q, denoting the number of nodes in the binary tree and the number of queries respectively.
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'
Next Q lines contains a single integer q[i]

Constraints:
1 <= N <= 10^3
1<= Q <= 10^3For each query print in a separate line the mirror image of the node if it exists, otherwise print -1.Sample Input 1:
7 4
2 4
5 3
-1 -1
-1 7
6 -1
-1 -1
-1 -1
2
5
3
1

Sample output 1:
4
7
-1
1

Explanation: Given binary tree 
                1
               /  \
             2     4
            / \      \
          5    3     7
         /
       6
Query 1: mirror image of node 2 is node 4
Query 2: mirror image of node 5 is node 7
Query 3: mirror image of node 3 is the left child of node 4, but since there is no left child, print -1
Query 4: mentioned in statement, I have written this Solution Code: n,q=map(int,(input().split()))
l=[-1]*(n+1)
r=[-1]*(n+1)
l[0]=1
r[0]=1
for i in range(1,n+1):
	a,b=map(int,input().split())
	l[i]=a
	r[i]=b
def find(target,left,right):
	if left==-1 and right==-1:
		return False
	if left==target:
		print(right)
		return True
	if right==target:
		print(left)
		return True
	if left!=-1 and right!=-1:
		return find(target,l[left],r[right]) or find(target,r[left],l[right])
	return False
for i in range(q):
	temp=int(input())
	if temp==1:
		print(1)
	elif not find(temp,l[1],r[1]):
		print(-1), In this Programming Language: Python, Now tell me if this Code is compilable or not?