#include
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
node(int d)
{
data=d;
left=NULL;
right=NULL;
}
};
bool identical(node *root1,node *root2)
{
if(root1==NULL && root2==NULL)
return 1;
if(root1!=NULL && root2!=NULL)
{
return identical(root1->left,root2->left);
return identical(root1->right,root2->right);
}
return 0;
}
node *build(string s)
{
if (s == “true”)
{
int d;
cin >> d;
node *root = new node(d);
string l;
cin >> l;
if (l == “true”)
{
root->left = build(l);
}
string r;
cin >> r;
if (r == “true”)
{
root->right = build®;
}
return root;
}
return NULL;
}
int main()
{
node *root1=build(“true”);
node *root2=build(“true”);
bool temp=identical(root1,root2);
if(temp)
cout<<“true”;
else
cout<<"false";
}