i,p,q;main(f){for(gets(&p);f&~scanf("%d%d",&p,&q);i++)f=p-q*3e4<5e5;for(puts(f?"NO":"YES");--f%7;printf("%d\n",i));}