#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]; int quicksort(int a[], int l, int r) { if (l < r) { int p = a[rand() % (r - l + 1) + l]; int i = l - 1; int j = r + 1; while (true) { while (C[a[++i]][p] < 0); while (C[a[--j]][p] > 0); if (i >= j) break; swap(a[i], a[j]); } quicksort(a, l, i - 1); quicksort(a, j + 1, r); } } 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[i] == '<') { c = -1; } else if (str[i] == '>') { 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); } quicksort(a, 0, n - 1); cout << "!"; rep (i, n) cout << " " << a[i] + 1; cout << endl; return 0; }