n = int(input()) t = [0] * n for i in range(n): g,d = map(int, input().split()) t[i] = g - 30000*d if max(t) >= 500000: print("YES") c = t.index(max(t))+1 for _ in range(6): print(c) else: print("NO")