#include #include using namespace std; using namespace atcoder; struct Fast { Fast() { std::cin.tie(nullptr); ios::sync_with_stdio(false); cout << setprecision(10); } } fast; #define rep(i, a, b) for (int(i) = (a); (i) < (int)(b); (i)++) int guess(int i, int j) { cout << "? " << (i + 1) << " " << (j + 1) << endl; int l; cin >> l; return l; } int main() { int n; cin >> n; if (n == 1) { cout << "! 1 1" << endl; } else { int p = n / 2 + 1; for (; true; p++) { bool ok = true; for (int d = 2; d * d <= p; d += (d & 1) + 1) ok &= p % d != 0; if (ok) break; } int x = -1, y = -1; rep(i, 0, n) { int l = guess(i, i); if (l == p) { if (x == -1) x = i; else y = i; } } if (y == -1) { y = x; } else { if (guess(x, y) != p) swap(x, y); } vector a(n), b(n); a[x] = p; b[y] = p; rep(i, 0, n) { if (i != x) a[i] = guess(i, y) / p; if (i != y) b[i] = guess(x, i) / p; } cout << "!"; rep(i, 0, n) cout << " " << a[i]; rep(i, 0, n) cout << " " << b[i]; cout << endl; } }