import sys def main(): A = input() B = input() if is_zero_leading(A) or is_zero_leading(B): print("NG") sys.exit() try: int_A = int(A) int_B = int(B) if int_A < 0 or int_A > 12345: print("NG") elif int_B < 0 or int_B > 12345: print("NG") else: print("OK") except ValueError: print("NG") def is_zero_leading(value): if value == "0": return False elif value[0] == "0": return True else: return False if __name__ == '__main__': main()