using System; namespace yukicoder { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); int[] b = new int[a]; int c = 0; int d = 0; int ans=0; for(int i = 0; i < a; i++) { string[] s = Console.ReadLine().Split(' '); for(int j=0;j b[ans - 1]) { ans = x + 1; c = b[x]; } else if (b[x] == b[ans - 1]) { d=b[x]; } } else { if (b[x] != 0) { ans = x + 1; c = b[x]; } } } if (ans == 0 || d==c) ans = -1; Console.WriteLine(ans); } } }