local ffi = require 'ffi' local C, ct = ffi.C, ffi.typeof('int32_t[1]') ffi.cdef 'int scanf(const char *, ...)' io.write((function (p, q, n) local r=0 for i=1,n do C.scanf("%d%d",p,q) if 6*p[0]-q[0]*180000>=3000000 then r=i break end end return r~=0 and "YES\n"..string.rep(tostring(r).."\n",6) or "NO\n" end)(ct(), ct(), io.stdin:read("*n")))