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