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