from math import gcd n=int(input()) a=1 while True: a+=1 g=gcd(n,a) if g>1:break print("?",a) r=int(input()) if r%2==1:continue m=pow(a,r//2,n) g=gcd(n,m+1) if g>1 and g1 and g