A binary tree of GPS waypoint ids is given in level-order form. Line 1 is a single line of space-separated tokens (null marking a missing child; every non-null node contributes exactly two following tokens for its children). Every value that appears in the tree is distinct. Line 2 contains two distinct integers u v, both guaranteed to be values that appear somewhere in the tree.
Print the distance (the number of edges on the unique path) between the node whose value is u and the node whose value is v.
Input format
Line 1: space-separated level-order tokens describing the binary tree (integers and the token null); all values are distinct.
Line 2: two distinct integers u v, each guaranteed to be present in the tree.
Output format
A single integer: the number of edges on the path between the two named nodes.
Constraints
- 2 <= number of nodes <= 400
- Each node value is an integer with -100000 <= value <= 100000, and all node values are pairwise distinct
- u != v, and both are present among the tree's values