시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB0000.000%

문제

A boxing club has $N$ members, numbered $1, \ldots, N$. Each member has a fixed strength. The strengths are unique integers with unknown values.

In a boxing match, a stronger boxer always beats a weaker one... or rather, would beat in an honest match. The thing is, there are two cheaters in the club. They use illegal tricks and could beat any honest boxer. To avoid suspicion, each of them picks (independently from the other) a number of honest boxers; in subsequent matches, they will always win against the chosen boxers and deliberately lose against all others. The cheaters also agree on who will win when they meet each other in a match.

Now the coach has caught wind of the scheme and wants to expel the cheaters. For that, he arranged a tournament where each member met each other in a match. However, the club has many members, and the coach can't program, so he has asked you to help.

You are given the results of the tournament and need to find two members such that when these two are removed, the results of the remaining boxers are consistent with the "a stronger boxer always beats a weaker one" rule. If there are several possible solutions, output any one of them. The coach is not much of a justice warrior, he mainly just wants to blame someone...

입력

The first line contains $N$ ($3 \le N \le 3 \cdot 10^3$), the number of boxers. The following $N$ lines present a table consisting of 0, 1, and x. If the $i$-th boxer won against the $j$-th, then the table has 1 in the $i$-th row of the $j$-th column and 0 in the $j$-th row of the $i$-th column.

출력

Output two space-separated integers, the numbers of the cheaters, in any order. All the inputs are such that a solution exists.

예제 입력 1

6
x00011
1x1011
10x111
110x10
0000x1
00010x

예제 출력 1

1 4

If we remove the first and the fourth boxer, the remaining table is as follows:

x111
0x11
00x1
000x

It's now clear that the second boxer is the strongest, followed by the third, the fifth, and the sixth.

예제 입력 2

11
x1111010010
0x000001001
01x11011011
010x0001001
0101x010011
11111x10111
010100x0001
1000111x011
11111011x11
010100100x0
1000000001x

예제 출력 2

8 11