#include #define REP(i,b,n) for(int i=(int)(b);i<(int)(n);++i) #define rep(i,n) REP(i,0,n) using namespace std; // tr << ( vector, map, pair, tuple, etc... ) << endl//{{{ template struct sfinae_helper{typedef void type;}; template struct Print{ static ostream &pp(ostream &os, const T &x){ return os << x; } }; struct trace{//{{{ ostream& os; trace(ostream& os): os(os) { } template trace& operator<<(const T& x){ Print::pp(os, x); return *this;} trace &operator<<(ostream& f(ostream&)){ f(os); return *this; } operator ostream &(){ return os; } } tr(cout);//}}} // string//{{{ template <> struct Print{ static ostream &pp(ostream &os, const string &x){ return os << x; } }; //}}} // Container//{{{ template struct Print::type>{ static ostream &pp(ostream &os, const T &v){ trace(os) << '['; for(const auto &x : v) trace(os) << x << ", "; return trace(os) << ']'; } };//}}} // Pair//{{{ template struct Print::type>{ static ostream &pp(ostream &os, const T &x){ return trace(os) << '(' << x.first << ", " << x.second << ')'; } };//}}} // Tuple//{{{ template struct TuplePrint{ static ostream &print(ostream &os, const T &x){ TuplePrint::print(os, x) << ", "; return trace(os) << get(x); //return Print(x))>::pp(os, get(x)); } }; template struct TuplePrint{ static ostream &print(ostream &os, const T &x){ return trace(os) << get<0>(x); } }; template //Tuple struct Print>{ static ostream &pp(ostream &os, const tuple &x){ os << "("; return TuplePrint::print(os, x) << ")"; } };//}}} //}}} constexpr int N = 1000000; vector query(const int &n, vector ord){//{{{ if(rand() % 2) reverse(begin(ord), end(ord)); if(rand() % 2){ ord.pop_back(); reverse(begin(ord), end(ord)); } if(ord.size() % 2) ord.pop_back(); // rep(i, ord.size()/2) if(ord[i*2] < ord[i*2+1]) swap(ord[i*2], ord[i*2+1]); // return ord; cout << '?'; rep(i, ord.size()) cout << ' ' << ord[i]+1; rep(_, 2 * n - ord.size()) cout << ' ' << 0; cout << endl; cout.flush(); char ch; rep(i, ord.size()/2){ cin >> ch; if(ch == '>') swap(ord[i*2], ord[i*2+1]); } rep(_, n - ord.size()/2) cin >> ch; return ord; }//}}} bool solve(){ int n; cin >> n; vector> g(n); rep(cnt, 2000){ vector deg(n), q; rep(u, n) for(auto &v : g[u]) ++deg[v]; rep(u, n) if(!deg[u]) q.emplace_back(u); vector ord; bool ok = true; while(!q.empty()){ ok &= q.size() == 1; int idx = rand() % q.size(); swap(q[idx], q.back()); int u = q.back(); q.pop_back(); ord.emplace_back(u); for(auto &v : g[u]) if(!--deg[v]) q.emplace_back(v); } if(ok){ cerr << cnt << endl; cout << '!'; rep(i, n) cout << ' ' << ord[i]+1; cout << endl; break; } auto res = query(n, ord); rep(i, res.size()/2) g[res[i*2]].emplace(res[i*2+1]); } return true; } signed main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << std::fixed << std::setprecision(10); solve(); return 0; } // vim:set foldmethod=marker commentstring=//%s: