public static boolean compareNode(TreeNode p,TreeNode q){
        if(p.val!=q.val) return false;
        if((null!=p.left&&null==q.left) || (null==p.left&&null!=q.left)) return false;
        if((null!=p.right&&null==q.right) || (null==p.right&&null!=q.right)) return false;
        return true;
    }