a = input() b = input() if (len(a) > 1 and a[0] == '0') or (len(b) > 1 and b[0] == '0'): print("NG") exit() try: a = int(a) b = int(b) if 0 <= a <= 12345 and 0 <= b <= 12345: print("OK") else: print("NG") except: print("NG")