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