import math;n=int(input());print("?",2);r=int(input());print("!",g:=max([math.gcd(n,pow(b,r//(2-r%2),n)-1)%n for b in range(n)]),n//g)