def judge(strnum): if strnum.isdigit(): num = int(strnum) if num <= 12345 and 0 <= num and str(num) == strnum: return True else: return False a = input() b = input() if judge(a) and judge(b): print("OK") else: print("NG")