import java.util.Scanner; import java.util.Random; import java.io.IOException; import java.math.BigInteger; public class ShorSolve { static BigInteger n; static BigInteger randomBigInteger(){ int bitlen = n.bitLength(); BigInteger r; Random rnd = new Random(); do { r = new BigInteger(bitlen, rnd); } while(r.equals(BigInteger.ZERO) || r.compareTo(n) >= 0); return r; } public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); n = sc.nextBigInteger(); while(true){ BigInteger a = randomBigInteger(); BigInteger b = n.gcd(a); if(!b.equals(BigInteger.ONE)){ System.out.println("! " + b + " " + n.divide(b)); break; } System.out.println("? " + a); BigInteger r = sc.nextBigInteger(); if(r.testBit(0)){ continue; } r = r.shiftRight(1); a = a.modPow(r, n); if(a.equals(n.subtract(BigInteger.ONE))){ continue; } BigInteger p = n.gcd(a.add(BigInteger.ONE)); BigInteger q = n.divide(p); System.out.println("! " + p + " " + q); break; } } }