#include using namespace std; using ll = long long; using ld = long double; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++) const ll mod = 1e9 + 7; const int INF = 1e9; int main() { int K; cin >> K; K = pow(2, K); if (K == 2)cout << 1 << " " << 3 << " " << 2; else { reps(i, 1, K / 3 + 1) { if (i != 1)cout << " "; int k = i * 3; cout << k - 1 << " " << k - 2 << " " << k; } if (K % 3) { rep(i, (K-1) % 3) { cout << " " << K - i - 1; } } } cout << endl; return 0; }