/**
 * struct TreeNode {
 *	int val;
 *	struct TreeNode *left;
 *	struct TreeNode *right;
 * };
 */

class Solution {
public:
    /**
     * 
     * @param root1 TreeNode类 
     * @param root2 TreeNode类 
     * @return bool布尔型
     */
    bool isOk(TreeNode* root1, TreeNode* root2) {
        if(root1 == nullptr && root2 == nullptr) return true;
        if(root1 == nullptr || root2 == nullptr) return false;
        if(root1->val == root2->val) {
            if(!isOk(root1->left, root2->left)) return false;
            if(!isOk(root1->right, root2->right)) return false;
            return true;
        }else
            return false;
    }
    bool isContains(TreeNode* root1, TreeNode* root2) {
        // write code here
        if(isOk(root1, root2)) return true;
        if(root1->left && isContains(root1->left, root2)) return true;
        if(root1->right && isContains(root1->right, root2)) return true;
        return false;
    }
};