from collections import Counter cnt = Counter() N = int(input()) for i in range(1, N + 1): G, D = [int(i) for i in input().split()] cnt += {i:G - D * 30000} if len(cnt) > 0 and max(cnt.values()) * 6 >= 3000000: print("YES") d = max(cnt.items(), key=lambda x: x[1])[0] for _ in [0] * 6: print(d) else: print("NO")