#include<bits/stdc++.h>//submitRecord//
using namespace std;
//const int N=1e7+10;
int a[10],b[10];
int main(){
//freopen("","r",stdin);
//freopen("","w",stdout);
ios::sync_with_stdio();
cin.tie(nullptr);
cout.tie(nullptr);
for(int i = 1;i<=7;i++){
cin>>a[i]>>b[i];
}
int max = 0;
for(int i = 1;i<=7;i++){
if(a[i]+b[i]>8){
if(a[i]+b[i]>a[max]+b[max]){
max=i;
}
}
}
cout<<max;
//fclose(stdin);
//fclose(stdout);
return 0;
}