from math import * import random n=int(input()) g=0 while True: a=random.randrange(2,n) g=gcd(n,a) if g>1: break print("?",a) r=int(input()) if r%2==1: continue r//=2 m=pow(a,r,n) p=(m-1)%n g=gcd(n,p) if p>0 and g>1: break q=(m+1)%n g=gcd(n,q) if q>0 and g>1: break print("!",g,n//g)