#include using namespace std; template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector ans, S(n); vector> tb; ans.reserve(n); iota(S.begin(), S.end(), 1); int cnt = __lg(n) * (n - 1) - (n - 1) / 2 + 1, b = 0; for(int i = 0; i + 10 < n; i++){ int ok = 0, ng = S.size(), mid, v; while(ok + 1 < ng){ mid = (ok + ng) / 2; cout << "? " << ans << ' ' << S[mid] << endl; cin >> v; (v ? ok : ng) = mid; } ans.push_back(S[ok]); for(int j = ok; j + 1 < S.size(); j++) swap(S[j], S[j + 1]); S.pop_back(); } do{ tb.emplace_back(S); }while(next_permutation(S.begin(), S.end())); int ok = 0, ng = tb.size(), mid, v; while(ok + 1 < ng){ mid = (ok + ng) / 2; cout << "? " << ans << ' ' << tb[mid] << endl; cin >> v; (v ? ok : ng) = mid; } ans.insert(ans.end(), tb[ok].begin(), tb[ok].end()); cout << "! " << ans << endl; }