Confused Robber

easy
There is a house robber who is going to rob a particular house but he is only able to find the house if the structure of houses is in the form of "Binary Tree". But, Unfortunately people of colony are so smart and has converted the structure of area in the form of an "N ary Tree" and the thief is not able to find the house in the tree.
Now You Need to help him So that he can find the house easily and rob there.

You are given root of an "N ary tree". Now you need to convert the structure into a binary Tree So that the thief can Apply his "Find a location" in tree. But Keep in mind that after changing the given tree into binary tree Thief is also curious to Convert the binary tree into N ary tree back without any loss of data and structure.

You need to write 2 functions
1) Convert N-Ary structure into Binary Structure
2) Convert Binary Tree Back to N-Ary Tree.

Note: Find function is called internally which only works on binary tree.

Input Format

Level Order Of Generic Tree Target Node's Value to search

Output Format

Presence of target node

Constraints

The number of nodes in the tree is in the range [0, 10^4].
0 <= Node.val <= 10^4
The height of the n-ary tree is less than or equal to 1000

Notice

NA

Example

Input
1 null 2 3 4 null 5 6 7 null 8 9 10
10
Output
true
Previous
Peak_element
Next
Flip-flip-flip

Related Questions