533. Coding Test on Binary Tree

0

Easy

Find LCA(Lowest Common Ancestor) of two nodes in a Binary Tree.

Input Format

Enter the values of all the nodes in the binary tree in pre-order format where true suggest the node exists and false suggests it is NULL next two line contains 2 element of BT

Output Format

Display the LCA value.

Example

Input

10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false 50 60

Output

10

Constraints


Loading...

View Submissions

Console