i,t,p=input,int,print for x in range(t(i())): G,D=i().split() if t(G)>=10000*(50+3*t(D)):p('YES'+'\n%d'%-~x*6);break else:p('NO')