Boxers | 프로그래밍의 벗 PivotOJ
PivotOJ

Boxers

시간 제한: 1000ms메모리 제한: 1024MB출처: EIO 2020-21 finalBOJ 29904

문제

A boxing club has NN members, numbered 1,,N1, \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 NN (3N31033 \le N \le 3 \cdot 10^3), the number of boxers. The following NN lines present a table consisting of 0, 1, and x. If the ii-th boxer won against the jj-th, then the table has 1 in the ii-th row of the jj-th column and 0 in the jj-th row of the ii-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 4

예제 2

입력
11
x1111010010
0x000001001
01x11011011
010x0001001
0101x010011
11111x10111
010100x0001
1000111x011
11111011x11
010100100x0
1000000001x
출력
8 11
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.