The input consists of several test cases. The first line of each case contains an integers V (3<=V<=12) , the number of vertices in the graph, followed by a string in format ``Kn " or ``Kn ,m " (1<=n, m<=V) , the graph minor you're finding. The following V lines contain the adjacency matrix of the graph (1 means directly connected, 0 means not directly connected).
The diagonal elements of the matrix will always be 0, and the element in row i column j is always equal to the element in row j column i . The last test case is followed by a single zero, which should not be processed.