defisMirror(self,left,right): ifnot left andnot right: returnTrue ifnot left ornot right: returnFalse if left and right and left.val==right.val: outpair=self.isMirror(left.left,right.right) inpair=self.isMirror(left.right,right.left) return outpair and inpair