#include <bits/stdc++.h>
using namespace std;
int a[8], b[8], c[8], d[8];
int main() {
int t = 0;
for (int i = 1; i <= 7; i++) cin >> a[i] >> b[i];
for (int i = 1; i <= 7; i++) {
if (a[i] + b[i] > 8) {
c[i] = a[i] + b[i];
d[i] = i;
}
}
for (int i = 1; i <= 7; i++) {
if (c[t] < c[i])
t = d[i];
}
cout << t;
return 0;
}