N = int(input()) need = 3000000 max_d = 0 num_d = 0 for i in range(N): g, d = map(int, input().split()) get = g - (30000 * d) if get > max_d: max_d = get num_d = i + 1 if max_d * 6 > need: print("YES") for i in range(6): print(num_d) else: print("NO")