N = int(input()) L = [] for i in range(N): G, D = map(int, input().split()) if (G - D*30000) * 6 >= 3000000: L += [i+1] print('NO' if len(L) == 0 else '\n'.join(['YES'] + [str(L[0])]*6))