A = input() B = input() if (len(A) == 1 or A[0] != '0') and (len(B) == 1 or B[0] != '0'): try: A = int(A) B = int(B) if A <= 12345 and B <= 12345: print('OK') else: print('NG') except: print('NG') else: print('NG')