import math import random n = int(input()) while True: a = random.randrange(2, n - 1) gcda = math.gcd(n, a) if gcda > 1 and gcda < n: print("!", gcda, n // gcda) break print("?", a) b = int(input()) if b % 2 == 1: continue b2 = b // 2 powb2 = pow(a, b2, n) p = (powb2 + n - 1) % n gcdp = math.gcd(n, p) if p != 0 and gcdp > 1: print("!", gcdp, n // gcdp) break q = (powb2 + 1) % n gcdq = math.gcd(n, q) if q != 0 and gcdq > 1: print("!", gcdq, n // gcdq) break