n = int(input()) d = [] for _ in range(n): d.append(map(int, input().split())) mi = -1 mx = -1 for i, (g, d) in enumerate(d): x = g - 30000 * d if x > mx: mx = x mi = i if mx >= 30000 * 100 // 6: print("YES") print(*[mi+1]*6, sep="\n") else: print("NO")