n;s;main(f,t){for(;n?sprintf(&t,"%d",--n),f+=!strcmp(&s,&t):(n=gets(&s)?12346:!puts(f-3?"NG":"OK")););}