#include <iostream>
using namespace std;
int a[1010],b[1010],c[1010];
int main(){
int max=0,k;
for(int i=1;i<=7;i++){
cin>>a[i]>>b[i];
c[i]=a[i]+b[i];
if(c[i]>8 and c[i]>max){ max=c[i];k=i;}
}
cout<<k;
return 0;
}