A = input() B = input() def f(x): try: if int(x) > 12345: return False return str(int(x)) == x except: return False if f(A) and f(B): print("OK") else: print("NG")