https://vjudge.net/contest/402960#problem/J
Alex is a professional computer game player.
These days, Alex is playing a war strategy game. The kingdoms in the world form a rooted tree. Alex's kingdom 11 is the root of the tree. With his great diplomacy and leadership, his kingdom becomes the greatest empire in the world. Now, it's time to conquer the world!
Alex has almost infinite armies, and all of them are located at 11 initially. Every week, he can command one of his armies to move one step to an adjacent kingdom. If an army reaches a kingdom, that kingdom will be captured by Alex instantly.
Alex would like to capture all the kingdoms as soon as possible. Can you help him?
Input
The first line of the input gives the number of test cases, T (1≤T≤105)T (1≤T≤105). TT test cases follow.
For each test case, the first line contains an integer n (1≤n≤1