#include using namespace std; long long ask(int a, int b) { if (a > b) swap(a, b); cout << "? " << a << ' ' << b << '\n'; cout.flush(); long long p; cin >> p; if (p == -1) exit(0); return p; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; int r = N - 1; // leading digit position, guaranteed nonzero vector p(N, -1); // p[i] = d[i] * d[r] for i < r vector nonzero; for (int i = 0; i < r; i++) { p[i] = ask(i, r); if (p[i] != 0) nonzero.push_back(i); } auto output_minus_one = [&]() { cout << "! -1\n"; cout.flush(); exit(0); }; if (N == 2) { vector> cand; for (int lead = 1; lead <= 9; lead++) { for (int d0 = 0; d0 <= 9; d0++) { if (1LL * lead * d0 == p[0]) { cand.push_back({d0, lead}); } } } if ((int)cand.size() != 1) output_minus_one(); cout << "! " << cand[0].second << cand[0].first << '\n'; cout.flush(); return 0; } if ((int)nonzero.size() < 2) { output_minus_one(); } int a = nonzero[0]; int b = nonzero[1]; long long q = ask(a, b); vector ans(N, -1); vector> all; for (int lead = 1; lead <= 9; lead++) { vector d(N, -1); d[r] = lead; bool ok = true; for (int i = 0; i < r; i++) { if (p[i] % lead != 0) { ok = false; break; } d[i] = (int)(p[i] / lead); if (d[i] < 0 || d[i] > 9) { ok = false; break; } } if (!ok) continue; if (1LL * d[a] * d[b] != q) continue; all.push_back(d); } if ((int)all.size() != 1) { output_minus_one(); } ans = all[0]; string s; for (int i = N - 1; i >= 0; i--) { s.push_back(char('0' + ans[i])); } cout << "! " << s << '\n'; cout.flush(); return 0; }