a,k=0,30000 for i in range(int(input())): g,d=input().split();b=int(g)-int(d)*k if b>a:a,s=b,str(i+1)+'\n' print('NO'if b*6