#include <iostream>
using namespace std;
int main()
{
int ans = 0;
int a, b;
int maxans = 0;
for (int i = 1; i <= 7; i++)
{
cin >> a >> b;
if (a + b >= 8 && a + b > maxans)
{
ans = i;
maxans = a + b;
}
}
cout << ans;
return 0;
}