#include using namespace std; void insert(int v, int u, vector> &ch) { if (v < u) { if (ch[u][0] == -1) return ch[u][0] = v, void(); return insert(v, ch[u][0], ch); } else { if (ch[u][1] == -1) return ch[u][1] = v, void(); return insert(v, ch[u][1], ch); } } int max_dpt(int u, const vector> &ch) { if (u == -1) return -1; return max(max_dpt(ch[u][0], ch), max_dpt(ch[u][1], ch)) + 1; } int main() { ios::sync_with_stdio(false); int K; cin >> K; vector ans; for (int i = 0; i + 1 < 1 << K; ++i) { ans.emplace_back(i); } while (true) { random_shuffle(ans.begin(), ans.end()); vector> ch(1 << K, vector(2, -1)); for (int i = 1; i < int(ans.size()); ++i) { insert(ans[i], ans[0], ch); } int d = max_dpt(ans[0], ch); if (K <= d and d <= 3 * K) break; } for (int i = 0; i < int(ans.size()); ++i) { cout << ans[i] + 1 << " \n"[i + 1 == int(ans.size())]; } return 0; }