#include #define rep(i, a) rep2 (i, 0, a) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) repr2 (i, 0, a) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define chmin(a, b) ((b) < a && (a = (b), true)) #define chmax(a, b) (a < (b) && (a = (b), true)) #define rng(a) (a).begin(), (a).end() using namespace std; typedef long long ll; #include #define rep(i, a) rep2 (i, 0, a) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) repr2 (i, 0, a) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define chmin(a, b) ((b) < a && (a = (b), true)) #define chmax(a, b) (a < (b) && (a = (b), true)) #define rng(a) (a).begin(), (a).end() using namespace std; typedef long long ll; int n; int C[555][555]; int a[555]; void query(vector> v) { v.resize(n, make_pair(-1, -1)); cout << "?"; rep (i, v.size()) cout << " " << v[i].first + 1 << " " << v[i].second + 1; cout << endl; rep (i, n) { string str; cin >> str; if (v[i].first == -1) continue; int a = v[i].first; int b = v[i].second; int c; if (str[0] == '<') { c = -1; } else if (str[0] == '>') { c = 1; } else { c = 0; } C[a][b] = c; C[b][a] = -c; } } bool checked[555][555]; int main() { cin >> n; rep (i, n) a[i] = i; vector used(n); int num = 0; while (num < n * (n - 1) / 2) { fill(rng(used), false); vector> q; rep (i, n) { rep2 (j, i + 1, n) { if (!checked[i][j] && !used[i] && !used[j]) { q.emplace_back(i, j); checked[i][j] = true; num++; used[i] = true; used[j] = true; } if (q.size() == n) break; } if (q.size() == n) break; } query(q); } rep (i, n) { rep2 (j, i, n) { if (C[a[i]][a[j]] > 0) swap(a[i], a[j]); } } cout << "!"; rep (i, n) cout << " " << a[i] + 1; cout << endl; return 0; }