#include<iostream>
using namespace std;
int main()
{
int a[7], b[7];
for (int i = 0; i < 7; i++)
{
cin >> a[i] >> b[i];
}
int max = 0,t=0;
for (int i = 0; i < 7; i++)
{
if (a[i] + b[i] > max && a[i]+b[i] >= 8)
{
max = a[i] + b[i];
t = i+1;
}
}
cout << t;
system("pause");
}