a = input() b = input() for x in (a, b): if not x.isdigit(): print("NG") exit() if str(int(x)) != x: print("NG") exit() if x > 12345: print("NG") exit() print("OK")