#include using namespace std; #define ll long long #define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++) #define rrep(i, n, a) for (int i = (int)(n); i >= (int)(a); i--) bool isprime(int num){ if(num < 2) return false; for(int i = 2; i <= int(sqrt(num)); i++){ if( num % i == 0) return false; } return true; } void solve(){ int n; cin >> n; if(n == 1){ cout << "! 1 1" << endl; return; } int p; rrep(i, n, 1){ if(isprime(i)){ p = i; break; } } int prev = 1; int s = 1; int iA, iB = 0; rep(i,1,n+1){ cout << "? " << i << " " << 2 << endl; int cur; cin >> cur; if(cur % p == 0 && prev % p != 0){ iA = i; } else if(prev % p == 0 && cur % p == 0){ iB = i; iA = 0; } prev = cur; } vector A(n+1, 0), B(n+1, 0); if(iA != 0){ int c = 0; A[iA] = p; rep(i,1,n+1){ cout << "? " << iA << " " << i << endl; int cur; cin >> cur; B[i] = cur / p; if(cur == p){ if(c == 0){ cout << "? " << (iA)%n + 1 << " " << i << endl; cin >> cur; if(cur % p == 0){ c = 1; B[i] = p; iB = i; } else { c = 2; } } else if(c == 2){ B[i] = p; iB = i; c = 1; } } } rep(i,1,iA){ cout << "? " << i << " " << iB << endl; int cur; cin >> cur; A[i] = cur / p; } rep(i,iA+1,n+1){ cout << "? " << i << " " << iB << endl; int cur; cin >> cur; A[i] = cur / p; } } else { int c = 0; B[iB] = p; rep(i,1,n+1){ cout << "? " << i << " " << iB << endl; int cur; cin >> cur; A[i] = cur / p; if(cur == p){ if(c == 0){ cout << "? " << i << " " << (iB)%n + 1 << endl; cin >> cur; if(cur % p == 0){ c = 1; A[i] = p; iA = i; } else { c = 2; } } else if(c == 2){ A[i] = p; iA = i; c = 1; } } } rep(i,1,iB){ cout << "? " << iA << " " << i << endl; int cur; cin >> cur; B[i] = cur / p; } rep(i,iB+1,n+1){ cout << "? " << iA << " " << i << endl; int cur; cin >> cur; B[i] = cur / p; } } cout << "! "; rep(i, 1, n+1) cout << A[i] << " "; rep(i, 1, n+1) cout << B[i] << " "; cout << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int t = 1; //cin >> t; rep(i,0,t) solve(); return 0; }