#include<iostream>
using namespace std;
struct Node
{
int value;
Node* left;
Node* right;
};
bool Traver(Node* pa, Node* pb)
{
if (pb == NULL)
return true;
if (pa == NULL)
return false;
if (pa->value != pa->value)
return false;
return Traver(pa->left, pb->left) && Traver(pa->right, pb->right);
}
bool HasSubTree(Node* rootA, Node* rootB)
{
bool has = false;
while (rootA != NULL && rootB != NULL)
{
if (rootA->value == rootA->value)
has = Traver(rootA, rootB);
if (!has)
HasSubTree(rootA->left, rootB);
if (!has)
HasSubTree(rootB->right, rootB);
}
return has;
}