#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn=10;
int Ps(){
freopen("unhappy.in","r",stdin);
freopen("unhappy.out","w",stdout);
int x,y;
int ans=0,cnt=0;
for(int i=1;i<=7;i++){
scanf("%d%d",&x,&y);
if(x+y>ans){
ans=x+y;cnt=i;
}
}
if(ans>8)printf("%d\n",cnt);
else printf("0\n");
}
int Pt=Ps();
int main(){
;
}