Problem F
Atlögur
Languages
en
is
Guðmundur is a Ph.D. student at an Icelandic university, where he studies history. He has a burning interest in duels and the ways of knights of past times. In the middle ages, and the ages before them, battles between knights were common. His research revolves around these knights and, in particular, he is interested in writing about the most victorious knight.
Guðmundur has found a manuscript describing
The knight that made the challenge struck first. When knight
There can be only one that stands victorious after all the battles. Which knight will win?
Input
The first line of the input contains one integer
Output
Output one integer, the index of the knight that stands victorious after all the battles.
Sample Input 1 | Sample Output 1 |
---|---|
3 4 1 4 1 2 1 |
3 |
Sample Input 2 | Sample Output 2 |
---|---|
6 12 1 4 3 2 6 3 4 1 12 6 2 |
3 |
Sample Input 3 | Sample Output 3 |
---|---|
5 14 3 43 6 32 8 13 9 29 5 |
5 |