A, B = [input().strip() for _ in range(2)] ans = A.isnumeric() and B.isnumeric() if ans == True: ans = int(A[0]) * int(B[0]) != 0 A, B = int(A), int(B) ans = ans and (A >= 0) and (B >= 0) and (A <= 12345) and (B <= 12345) print(['NG', 'OK'][ans])