#coding: UTF-8 import sys import re import itertools from collections import deque ### defs ### ### main ### N = int(sys.stdin.readline()) gd = [] for i in range(N): gd.append(list(map(int,sys.stdin.readline().split()))) gd[-1].append(i+1) gd.sort(key=lambda x : (x[0]-30000*x[1])) gd.reverse() if (6*(gd[0][0]-30000*gd[0][1]) >= 3000000): print('YES') for _ in range(6): print(gd[0][2]) else: print('NO')