a=[] t,f,i=0,0,1 while i<=7: c,b = map(int, input().split()) a.append(c) a.append(b) i += 1 i=0 while i<14: if i%2==0 and t==0 and a[i]+a[i+1]>8: f=i//2+1 t=1 i+=1 print(f)