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