try: A = int(input()) assert not (str(A)[0] == '0') assert 0 <= A <= 12345 B = int(input()) assert not (str(B)[0] == '0') assert 0 <= B <= 12345 except: print("NG") exit(0) print("OK")