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