시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB145430.769%

문제

Izhevsk Training Camp is about to begin! This season $n$ teams numbered with consecutive integers from $1$ to $n$ will take part in this event. Nine sophisticated contests will be offered to participating teams in eleven days period. Contest are numbered with consecutive integers from $1$ to $9$. Three of these contests will form the Udmurtia Head Super Cup (UHSC). The question is: what three contests to choose for UHSC?

Oleg is helping to hold the Izhevsk Training Camp. For any contest he knows in advance what place each of the $n$ teams will take in this contest. He wants to use his knowledge to select three contests in order to minimize the total boredom of UHSC.

The boredom of UHSC can be computed as number of pairs of teams {$i$, $j$} such that team $i$ won team $j$ in each of three UHSC contests.

You are to write a program that will help Oleg to find three contests $a$, $b$ and $c$ for UHSC such that the total boredom of UHSC is minimum possible.

입력

The first line of input contains an integer $n$ --- the number of participating teams  ($2 \leq n \leq 2^{16}$).

The $i$-th of the following nine lines contains the $i$-th contest description: $n$ unique positive integers from $1$ to $n$ --- team numbers ordered from the first place to the last.

출력

The only line of output should contain three positive integers $a$, $b$ and $c$ --- numbers of contests to choose for UHSC ($1 \leq a, b, c \leq 9$, $a \neq b, a \neq c, b \neq c$).

If there are multiple correct answers --- output any of them.

예제 입력 1

7
1 2 3 4 5 6 7
1 2 4 5 3 7 6
1 3 2 5 7 6 4
1 2 3 4 5 7 6
1 2 3 4 5 6 7
2 1 3 4 5 6 7
7 1 2 3 4 5 6
5 4 1 3 6 7 2
1 2 4 5 3 6 7

예제 출력 1

3 7 8

힌트

For the sample test case the minimum possible value of boredom is $5$.