import math;G=math.gcd;a=g=2;n=int(input()) while g<3:print("?",a);t=pow(a,n//2*int(input()),n);a+=1;g=max(G(n,t-1),G(n,a)) print("!",g,n//g)