#include #include #include using namespace std; bool used[2000][501] = {}; vector arc[501]; int indeg[501] = {}; int n; void ask(vector &v){ cout << "?"; for(int x : v) cout << " " << x; for(int i = 0; i < 2*n-v.size(); i++) cout << " 0"; cout << endl << flush; char c; for(int i = 0; i < n; i++){ cin >> c; if(c == '=') continue; if(c == '<') arc[v[2*i]].push_back(v[2*i+1]), indeg[v[2*i+1]]++; else arc[v[2*i+1]].push_back(v[2*i]), indeg[v[2*i]]++; } } void answer(vector &v){ cout << "!"; for(int x : v) cout << " " << x; cout << endl << flush; } int main(){ cin >> n; vector v[2000]; for(int i = 1; i <= n; i++){ for(int j = i+1; j <= n; j++){ for(int k = 0;;k++){ // TLE? if(!used[k][i] && !used[k][j]){ used[k][i] = used[k][j] = true; v[k].push_back(i); v[k].push_back(j); break; } } } } for(int i = 0; i < 2000; i++){ if(v[i].size() == 0) break; ask(v[i]); } vector topo; queue q; for(int i = 1; i <= n; i++) if(indeg[i] == 0) q.push(i); while(!q.empty()){ int x = q.front(); q.pop(); topo.push_back(x); for(int child : arc[x]){ indeg[child]--; if(indeg[child] == 0) q.push(child); } } answer(topo); return 0; }