N = int(input()) p = [g - 30000*d for g, d in [map(int, input().split()) for _ in range(N)]] for i, x in enumerate(p): if x >= 500000: print("YES") for _ in range(6): print(i+1) break else: print("NO")