chk=3000000 n=int(input()) gd=[] num=6 ans=[] for i in range(n): g,d=map(int,input().split()) gd.append([g-d*30000,i+1]) gd=sorted(gd,key=lambda x:-x[0]) if gd[0][0]*6>=chk: print('YES') [print(gd[0][1]) for _ in range(6)] else: print('NO')