Shivam is a Geek and loves playing with matrix. Given a matrix containing 0’s and 1’s. Group all the row numbers (starting index 0) which are having 1’s at same position. Shivam being lazy wants your help to do the job.
The first line of input consists of T test cases. Then T test cases follow. The first line of every test case consists of a integer N, denoting number of rows and columns in the matrix. Second line of every test case consists N spaced elements Ai, denoting elements of the matrix (In the form of String).
For each test case in a single line output for each test case, print all the space separated row indices, if not possible to print then print "-1".
0010 0100 0010 0000
In the above test case, first and third row have the 1's at same column,i.e., 2(starting index from 0) so group first and third row. And print the index of first row, i.e., 0 (starting index from 0).
For second row, as it is the only row with same indexing of 1's so print it's index , i.e., 1
For forth row, 1 is not present in this row so didn't print anything.