import random import sys from math import gcd from functools import partial input = sys.stdin.readline print = partial(print, flush=True) done = set() n = int(input()) p, q = 1, 1 while x := random.randint(1, n-1): if x in done: continue done.add(x) if gcd(x, n) > 1: print(f'! {x} {n//x}') sys.exit() print(f'? {x}') r = int(input()) if r % 2 or pow(x, r//2, n) == n-1: continue p = gcd(pow(x, r//2, n)-1, n) print(f'! {p} {n//p}')