//丹阳新区实小路彦
include [HTML_REMOVED]
using namespace std;
long long a[10001], b[10001], c[10001], w[10001], maxn, maxs;
bool p;
int main()
{
for (int i = 1; i <= 7; i)
{
cin >> a[i] >> b[i];
c[i] = a[i] + b[i];
w[i] = i;
if (c[i] > 8) p = 1;
}
if (p == 0)
{
cout << 0 << endl;
return 0;
}
for (int i = 1; i <= 7; i)
{
if (maxn < c[i])
{
maxn = c[i];
maxs = w[i];
}
}
cout << maxs << endl;
return 0;
}