#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int,int> P; typedef vector<ll> VI; typedef vector<VI> VVI; #define REP(i,n) for(int i=0;i<n;i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=998244353; constexpr ll INF=1e18; int main(){ int n; cin >> n; int m=n; n=n*n-n; int a, b; vector<P> p(n), ans(n,{-1,-1}); map<P,int> mp; vector<P> same; int mx=-1, mn=2*n; int mxp, mnp; REP(i,n){ cout << "? " << i+1 << " " << 1 << endl; cin >> a >> b; p[i]={a,b}; if(mp[p[i]]!=0) same.push_back({mp[p[i]]-1,i}); else mp[p[i]]=i+1; if(a+b>mx){ mx=a+b; mxp=i; } if(a+b<mn){ mn=a+b; mnp=i; } } int ox, oy; int ff=-p[mnp].first+p[mxp].first+1; if(ff==m||ff==m-1){ if(ff==m){ ox=-p[mnp].first; oy=-p[mnp].second+1; } else{ ox=-p[mnp].second; oy=-p[mnp].first+1; } } else{ int sf=-p[mnp].second+p[mxp].first+1; if(sf==m){ ox=-p[mnp].second; oy=-p[mnp].first+1; } else{ ox=-p[mnp].first; oy=-p[mnp].second+1; } } ans[0]={ox,oy}; ans[mnp]={0,1}; ans[mxp]={m-1,m-1}; if(ox==oy){ for(P s:same){ cout << "? " << s.first+1 << " " << mnp+1 << endl; cin >> a >> b; P c1={ox+p[s.first].first,oy+p[s.first].second}; P c2={ox+p[s.first].second,oy+p[s.first].first}; if(c1==P{a,b+1}||c1==P{b,a+1}){ ans[s.first]=c1; ans[s.second]=c2; } else{ ans[s.first]=c2; ans[s.second]=c1; } } } else{ for(P s:same){ cout << "? " << mxp+1 << " " << s.first+1 << endl; cin >> a >> b; P c1={ox+p[s.first].first,oy+p[s.first].second}; P c2={ox+p[s.first].second,oy+p[s.first].first}; if(c1==P{m-1-a,m-1-b}||c1==P{m-1-b,m-1-a}){ ans[s.first]=c1; ans[s.second]=c2; } else{ ans[s.first]=c2; ans[s.second]=c1; } } } cout << "! "; REP(i,n){ if(ans[i]==P{-1,-1}){ P c1={ox+p[i].first,oy+p[i].second}; if(c1.first>=0&&c1.first<m&&c1.second>=1&&c1.second<m) ans[i]=c1; else ans[i]={ox+p[i].second,oy+p[i].first}; } cout << ans[i].first+ans[i].second*m << " "; } cout << endl; return 0; }