def s(): try: a=input() assert a==str(int(a))and int(a)<12346 return 1 except: return 0 print(["NG","OK"][s()and s()])