|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||1||1||1||100.000%|
Luke does not like studying, but he really wants to pass the extremely hard exam from the first year.
Somebody has told him that all the students from the second year know the answers from the exam, but that is far from real truth. In fact, no one from the second year knows the answers but they all think that somebody else knows.
Luke chooses some student A and asks him about the answers. Student A says that he/she doesn't know, but that he/she thinks that student B knows the answers. After that, Luke is asking student B, and so on...
When he finally realizes that this method will give him no useful results, he is very sad, but then he realizes that he can meet many older students this way, which could be useful some day.
Write a program to find the student which Luke must ask first, so that the total number of students Luke meets in the process is as high as possible.
First line of input contains an integer N, 2 ≤ N ≤ 1000, the number of students. Students are designated with numbers from 1 to N.
Each of the following N lines contains one number. First line contains the number denoting the answer of student 1, second line contains the number denoting the answer of student 2, and so on...
First and only line of output should contain the designation of the student that Luke should ask first.
If there is more than one solution, output the one with the smallest designation.
3 3 3 1
4 2 3 4 1
6 2 3 4 3 1 1