Dividing the graph#1992

Dividing the graph

1 second
128 megabytes
Easy

Divide the set of vertices of a given graph into two nonempty subsets A and B so that the number of edges between the subsets is minimized.

Input

The first line contains the number of vertices (2 \leq n \leq 50) in the graph. Each of the next lines contains characters. The -th character in the -th line is if there is an edge between vertices and , and otherwise. The adjacency matrix of the graph is antireflexive (the diagonal elements are ) and symmetric (with respect to the main diagonal).

Output

Output two lines. In the first line print the numbers of the vertices in set separated by spaces, and in the second line print the numbers of the vertices in set separated by spaces. The vertex numbers may be output in any order.

Examples

Example 1

Loading
Loading