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