def f(s): if len(s) >= 2 and s[0] == "0": print("NG") exit() def g(s): for c in s: if 0 <= ord(c) - ord("a") <= 25: print("NG") exit() if 0 <= ord(c) - ord("A") <= 25: print("NG") exit() A = input() B = input() f(A) f(B) g(A) g(B) print("OK")