#include <stdio.h> int main() { int a,b,m=0; for(int i=1;i<=7;i++) { scanf("%d %d",&a,&b); if(m==0&&a+b>8) {m=i;} } printf("%d",m); return 0; }