for i in range(input()): g,d=map(int,raw_input().split()) if g>499999+30000*d:print"YES"+"\n%d"%-~i*6;exit(0) print "NO"