n=int(input()) l=sorted((tuple([i+1]+list(map(int,input().split()))) for i in range(n)),key=lambda x:30000*x[2]-x[1]) a,g,d=l[0] if 6*(g-30000*d)>=30000: print(*(["YES"]+[a]*6),sep="\n") else: print("NO")