class Solution(object):
    def symtr(self,root1, root2):
        if(root1==None and root2==None):
            return True
        elif(root1==None and root2!=None or root1!=None and root2==None or root1.val != root2.val):
            return False
        return symtr(root1.right,root2.left) and symtr(root1.left,root2.right)
    
    def isSymmetric(self, root):
        if(root==None):
            return True
        else:
            x=symtr(root.left,root.right)
            return x