#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } using mint = atcoder::modint998244353; // isqrt long long isqrt(long long n) { if (n <= 0) return 0; long long x = sqrt(n); if (x * x > n) x--; return x; } void solve() { int n; cin >> n; int qn = 0; auto query = [&](int a, int b) { if (qn == n) { cout << "! -1" << endl; exit(0); } qn++; if (a > b) swap(a, b); cout << "? " << a << " " << b << endl; int p; cin >> p; assert(p != -1); return p; }; vector v(n, -1); rep(i, 0, n - 1) v[i] = query(i, n - 1); vector t; rep(i, 0, n - 1) if (v[i] > 0) t.push_back(i); if (t.size() < 2) { if (t.size() == 1) { int x = v[t[0]]; for (int y : {1, 5, 6, 7, 8, 9}) if (x == y * y) { v[n - 1] = y; v[t[0]] = y; cout << "! "; rep(i, 0, n) cout << v[n - 1 - i]; cout << "\n"; return; } } cout << "! -1\n"; return; } ll p = query(t[0], t[1]); ll tmp = p * v[t[0]] * v[t[1]]; ll sq = isqrt(tmp); assert(sq * sq == tmp && sq % p == 0); v[n - 1] = sq / p; assert(v[n - 1] < 10); rep(i, 0, n - 1) { assert(v[i] % v[n - 1] == 0); v[i] /= v[n - 1]; assert(v[i] < 10); } cout << "! "; rep(i, 0, n) cout << v[n - 1 - i]; cout << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int t = 1; // cin >> t; while (t--) solve(); }