#include using namespace std; int main() { int N; cin >> N; vector> _A(N); int a = -1; for (int i = 0; i < N; i++){ cout << "? " << i + 1 << ' ' << i + 1 << endl; cin >> _A[i].first; int j = i + 3; while (j > N){ j -= N; } cout << "? " << i + 1 << ' ' << j << endl; cin >> _A[i].second; if (gcd(_A[i].first, _A[i].second) == 1){ a = i + 1; } } vector B(N); for (int i = 0; i < N; i++){ cout << "? " << a << ' ' << i + 1 << endl; cin >> B[i]; } vector A(N); for (int i = 0; i < N; i++){ for (int j = 1; j <= N; j++){ if (lcm(j, B[i]) == _A[i].first and lcm(j, B[(i + 2) % N]) == _A[i].second){ A[i] = j; break; } } } cout << "! "; for (int i = 0; i < N; i++){ cout << A[i]; cout << ' '; } for (int i = 0; i < N; i++){ cout << B[i]; if (i + 1 < N){ cout << ' '; } } cout << endl; }