class Solution {
public:
bool isSymmetric(TreeNode *root) {
if(root==NULL)return true;
return Symmet(root->left,root->right);
}
bool Symmet(TreeNode *l,TreeNode *r){
if(!l&&!r)return true;
if((!l&&r)||(l&&!r))return false;
if(l->val!=r->val)return false;
return Symmet(l->left,r->right)&&Symmet(l->right,r->left);
}
};