You are given a tree consisting of \(N\) vertices. Its root is not fixed yet. The \(potential\) of a non-leaf vertex is the count of its children (distance of \(1\) from the vertex) with a non-zero \(potential\). The \(potential\) of a leaf vertex \(i\) is \(i \% 2\).
Your task is to calculate the \(potential\) of every possible root. Find an array \(A\) such that \(A[i]\) represents the \(potential\) of vertex \(i\) if the tree was rooted at \(i\).
Input Format:
Output Format:
For each test case, print an array \(A\) such that \(A[i]\) represents the \(potential\) of vertex \(i\) if the tree was rooted at \(i\).
Constraints:
\(1 <= T <= 10\)
\(3 <= N <= 10^5\)
\(0 <= u, v < N\)
First test case:-
Second test case:-