#include #include using namespace boost::multiprecision; namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; constexpr unsigned int BSZ = 2048 * 2; using UINT = number >; UINT fact[401]; } int main() { ios::sync_with_stdio(false); cin.tie(0); fact[0] = 1; for (int i = 1; i <= 400; i++) fact[i] = fact[i-1] * i; int n; cin >> n; auto r = fact[n]; UINT l = 0; VI p; auto get_kth = [&](UINT k) { VI q(n); VI rest(n); rep(i, n) rest[i] = i + 1; rep(i, n) { auto unit = fact[n - 1 - i]; auto j = int(k / unit); q[i] = rest[j]; rest.erase(rest.begin() + j); k -= j * unit; } return q; }; auto check = [&](const auto& q) { cout << "?"; for (int x : q) cout << ' ' << x; cout << endl; int ret; cin >> ret; if (ret == -1) exit(0); return ret; }; while (r - l > 1) { auto c = (l + r) / 2; auto q = get_kth(c); if (check(q)) l = c; else r = c; } auto q = get_kth(l); cout << "!"; for (int x : q) cout << ' ' << x; cout << endl; }