The first line contains one integer T (1≤T≤40000), the number of test cases.
For each test case, the first line contains one integer n (2≤n≤5000), the number of vertices.
The next n−1 lines give out the compressed lower triangular matrix in the following way:
Each line contains an uppercase hexadecimal string, where the j-th hexadecimal of the i-th string Si,j=∑3k=02k×Ei+1,4j+k−3, and Ei,j=1 iff the direction of the edge between i,j is from i to j. All indices start from 1.
It is guaranteed that there are at most 3 test cases in which the n is larger than 10.