def main(): A = input() B = input() try: A_num = int(A) except ValueError: print("NG") return try: B_num = int(B) except ValueError: print("NG") return if A != str(A_num) or B != str(B_num): print("NG") return if 0 <= A_num <= 12345 and 0 <= B_num <= 12345: print("OK") return print("NG") if __name__ == "__main__": main()