package extra; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class P3056 { static Scanner in; static PrintWriter out; static String INPUT = ""; static BigInteger ord(BigInteger A) { out.println("? " + A); out.flush(); return new BigInteger(in.next()); } // https://qiita.com/satto_sann/items/373e974a451896d728bb static void solve() { BigInteger N = new BigInteger(in.next()); int len = (N.bitLength()+7)/8; Random gen = new Random(1); while(true) { byte[] bs = new byte[len]; gen.nextBytes(bs); BigInteger X = new BigInteger(bs).abs(); if(X.compareTo(N) >= 0)continue; if(!X.gcd(N).equals(BigInteger.ONE))continue; BigInteger T = ord(X); BigInteger P1 = X.modPow(T.shiftRight(1), N).add(BigInteger.ONE); BigInteger M1 = X.modPow(T.shiftRight(1), N).subtract(BigInteger.ONE); P1 = P1.gcd(N); M1 = M1.gcd(N); if( !P1.equals(BigInteger.ONE) && !M1.equals(BigInteger.ONE)) { out.println("! " + P1 + " " + M1); out.flush(); return; } } } public static void main(String[] args) throws Exception { in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT); out = new PrintWriter(System.out); solve(); out.flush(); } static int ni() { return Integer.parseInt(in.next()); } static long nl() { return Long.parseLong(in.next()); } static double nd() { return Double.parseDouble(in.next()); } static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }