A = input() B = input() def check(s) : try : a = int(s) except Exception as error : return False if (a < 0) or (a > 12345) or (str(a) != s) : return False return True print("OK" if check(A) and check(B) else "NG")