import math
import random
n=int(input())
g=0
while True:
	a=random.randrange(2,n-1)
	g=math.gcd(n,a)
	if g>1:
		break
	print("?",a)
	r=int(input())
	if r%2==1:
		continue
	r//=2
	m=pow(a,r,n)
	p=(m-1)%n
	g=math.gcd(n,p)
	if p>0 and g>1:
		break
	q=(m+1)%n
	g=math.gcd(n,q)
	if q>0 and g>1:
		break
print("!",g,n//g)