You are given an undirected graph with n vertices numbered 0 through n−1. Obviously, the set of vertices have 2n−1 non-empty subsets. For a non-empty subset S, a proper coloring of S is a way to assign each vertex in S a color, so that no two vertices in S with the same color are directly connected by an edge. Assume we used k different kinds of colors in a proper coloring. The chromatic number of subset S is the minimum possible k among all the proper colorings of S.
Now your task is to compute the chromatic number of every non-empty subset of n vertices.
The first line contains an integer T. Then T test cases follow.
The first line of each test case contains an integer n. Each of then next n lines contains a string consisting of '0' and '1'. For 0≤i≤n−1 and 0≤j≤n−1, if the j-th character of the i-th line is '1', then vertices i and j are directly connected by an edge, otherwise they are not directly connected.
The i-th character of the i-th line is always '0'. The i-th character of the j-th line is always the same as the j-th character of the i-th line.
For all test cases, 1≤n≤18. There are no more than 100 test cases with 1≤n≤10, no more than 3 test cases with 11≤n≤15, and no more than 2 test cases with 16≤n≤18.
For each test case, print an integer on a separate line. This integer is determined as follows: We define the identity number of subset S as id(S)=∑_v∈S2v. Let the chromatic number of S be f_id(S). You need to output (∑_id(S)=12n−1f_id(S)⋅233id(S))mod232.
For the first test case, ans\[1..15]=1,1,2,1,2,2,3,1,1,1,2,2,2,2,3.