A = input() B = input() if (A.isdigit() and B.isdigit() and A.startswith("0") == False and B.startswith("0") == False or A == "0" or B == "0"): if (0 <= int(A) <= 12345 and 0 <= int(B) <= 12345): print("OK") else: print("NG") else: print("NG")