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