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