i,c=input,lambda x:(x==str(int(x)))*(int(x)<12346) def f(): try:return c(i())*c(i()) except:0 print('NOGK'[f()::2])