#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define gcd __gcd
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ts cin.tie(nullptr)->sync_with_stdio(false);
#define debug cout<<"HI"<<endl;
const int inf = 1e9;
const ll infll = 1e18;
using namespace std;
vector<int> construct_permutation(ll k){
if(k==1) return {};
if(k%2==0){
auto a=construct_permutation(k/2);
a.push_back(a.size());
return a;
} else {
auto a=construct_permutation(k-1);
a.insert(a.begin(), a.size());
return a;
}
}
// int main(){
// ts
// ll n; cin >> n;
// auto v = construct_permutation(n);
// for(auto &i:v) cout << i << " ";
// return 0;
// }