#include #include #include #include #include #include using namespace std; const int YET = -2; const int CHECKING = -1; const int SAME = 0; const int LIGHT = 1; const int HEAVY = 2; int main() { int n, n2; cin >> n; vector< vector > compared(n + 1, vector(n + 1, YET)); for (int i = 1; i <= n; i++) { compared[i][i] = SAME; } while (1) { vector output(n * 2, 0); vector usable(n + 1, true); int idx = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (compared[i][j] == YET && usable[i] && usable[j]) { compared[i][j] = CHECKING; compared[j][i] = CHECKING; usable[i] = false; usable[j] = false; output[idx++] = i; output[idx++] = j; break; } } } if (output[0] == 0) { break; } cout << "?"; for (int i = 0; i < n * 2; i++) { cout << " " << output[i]; } cout << endl << flush; char c; for (int i = 0; i < n; i++) { cin >> c; switch (c) { case '>': compared[output[2*i]][output[2*i+1]] = HEAVY; compared[output[2*i+1]][output[2*i]] = LIGHT; break; case '<': compared[output[2*i]][output[2*i+1]] = LIGHT; compared[output[2*i+1]][output[2*i]] = HEAVY; break; default: compared[output[2*i]][output[2*i+1]] = SAME; compared[output[2*i+1]][output[2*i]] = SAME; break; } } } vector > rank(n); for (int i = 1; i <= n; i++) { rank[i - 1] = make_pair(count(compared[i].begin(), compared[i].end(), HEAVY) , i); } sort(rank.begin(), rank.end()); cout << "!"; for (int i = 0; i < n; i++) { cout << " " << rank[i].second; } cout << endl << flush; return 0; }