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