from math import gcd import random n=int(input()) 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 p=(pow(a,r,n)-1)%n g=gcd(n,p) if g>1 and g1 and g