#include using namespace std; using ull = unsigned long long; ull modpow(ull x, ull n, ull mod = -1) { ull res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); ull n; cin >> n; mt19937 mt(0); uniform_int_distribution<> rnd(1, n - 1); ull p = 0, q = 0; do { p = rnd(mt); if (p % 2 == 0) continue; cout << "? " << p << endl; ull r; cin >> r; if (r % 2 == 1) continue; r >>= 1; ull hoge = modpow(p, r, n); if (hoge == 1 || hoge == n - 1) continue; p = __gcd(hoge + 1, n); q = __gcd(hoge + n - 1, n); break; } while (p * q != n); cout << "! " << p << " " << q << endl; return 0; }