import sys from random import randint from math import gcd n=int(input()) while True: a=randint(2, n-1) g=gcd(a, n) if g!=1: print("! %d %d" % (g, n//g)) sys.stdout.flush() break print("? %d" % a) sys.stdout.flush() r=int(input()) if r%2==1: continue x=pow(a, r//2, n) if x==n-1: continue p=math.gcd(x+1, n) print("! %d %d" % (p, n//p)) sys.stdout.flush() break