from random import randint from sys import exit from math import gcd def answer(p): print('!', p, n // p) exit(0) n = int(input()) while True: x = randint(2, n - 2) if gcd(n, x) > 1: answer(x) print('?', x, flush = True) r = int(input()) if r % 2 == 0: p = pow(x, r // 2, n) + 1 if p != n: answer(p)