int lowestCommonAncestor(TreeNode<int> *root,
int x, int y)
{
if(!root)
return -1;
if(root->data==x or root->data==y)
return root->data;
int lefti=lowestCommonAncestor(root->left,x,y);
int righti=lowestCommonAncestor(root->right,x,y);
if(lefti==-1)
return righti;
if(righti==-1)
return lefti;
return root->data;
}