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