import math import random n = int(input()) while True: a = random.randint(2, n - 1) g = math.gcd(a, n) if g > 1: print('! %d %d' % (g, n / g), flush = True) break print('? %d' % a, flush = True) r = int(input()) if r % 2 == 1: continue p = math.gcd(pow(a, r // 2, n) + 1, n) q = math.gcd(pow(a, r // 2, n) - 1, n) if p < n and q < n: print('! %d %d' % (p, q), flush = True) break