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