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