import random from math import gcd def calc(x, n): cnt = 1 hoge = x % n while hoge != 1: hoge = hoge * x % n cnt += 1 return cnt def main(): n = int(input()) while True: p = random.randint(1, n - 1); if p % 2 == 0 or gcd(n, p) != 1: continue print("? {}".format(p), flush=True) r = int(input()) if r % 2 == 1: continue r >>= 1 hoge = pow(p, r, n) if hoge == 1 or hoge == n - 1: continue p = gcd(hoge + 1, n) q = gcd(hoge + n - 1, n) if p * q == n: print("! {} {}".format(p, q), flush=True) break if __name__ == "__main__": main()