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