#include using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = long long; using P = std::tuple; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; vector v; struct Tree{ shared_ptr left; int v; shared_ptr right; Tree(shared_ptr left, int v, shared_ptr right) : left(left), v(v), right(right) {} }; void add(shared_ptr &t, int v){ if(t){ if(v < t->v){ add(t->left, v); }else{ add(t->right, v); } }else{ t = make_shared(nullptr, v, nullptr); } } int height(shared_ptr t){ if(t){ return max(height(t->left), height(t->right)) + 1; } return 0; } int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int K; std::cin >> K; v.resize((1 << K) - 1); iota(v.begin(), v.end(), 1); random_device rnd; mt19937 engine(rnd()); while(true){ shuffle(v.begin(), v.end(), engine); shared_ptr t = nullptr; for(int x : v){ add(t, x); } int h = height(t); if(K <= h && h <= 3 * K){ for(int i=0;i