import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int max = 0;
int unhappy = 0;
for(int i = 1;i <= 7;i++){
int a = scanner.nextInt();
int b = scanner.nextInt();
if(a + b > 8 && a + b > max){
max = a + b;
unhappy = i;
}
}
System.out.println(unhappy);
}
}