N = int(input()) b = [] for i in range(N): a=[int(i) for i in input().split()] x,y = a[0],a[1]*30000 b.append(x) if max(b)*6 >= 3000000: print("YES") for i in range(6): print(b.index(max(b))+1) else: print("NO")