#include <bits/stdc++.h>

using namespace std;

void solve(int n, int i, int& msum, vector<int>& g1, vector<int>& g2, vector<int>& hi1, vector<int>& hi2){
    if (g1.size() == n && g2.size() == n){
        vector<int> og1 = g1, og2 = g2;

        do{
            do{
                int sum = 0;
                for (int i = 1; i < n; ++i){
                    sum += abs(g1[i] - g1[i - 1]);
                }
                for (int i = 1; i < n; ++i){
                    sum += abs(g2[i] - g2[i - 1]);
                }

                if (sum > msum){
                    msum = sum;
                    copy(g1.begin(), g1.end(), hi1.begin());
                    copy(g2.begin(), g2.end(), hi2.begin());
                }
            }while(next_permutation(g2.begin(), g2.end()));
            sort(g2.begin(), g2.end());
        }while(next_permutation(g1.begin(), g1.end()));

        copy(og1.begin(), og1.end(), g1.begin());
        copy(og2.begin(), og2.end(), g2.begin());
        return;
    }

    if (g2.size() == n){
        g1.push_back(i + 1);
        solve(n, i + 1, msum, g1, g2, hi1, hi2);
        g1.pop_back();
        return;
    }

    if (g1.size() == n){
        g2.push_back(i + 1);
        solve(n, i + 1, msum, g1, g2, hi1, hi2);
        g2.pop_back();
        return;
    }

    g1.push_back(i + 1);
    solve(n, i + 1, msum, g1, g2, hi1, hi2);
    g1.pop_back();

    g2.push_back(i + 1);
    solve(n, i + 1, msum, g1, g2, hi1, hi2);
    g2.pop_back();
}

int main()
{
    int n;cin>>n;
    int msum = 0;
    vector<int> h1(n), h2(n), g1, g2;

    if (n > 13)
        return 0;

    solve(n, 0, msum, g1, g2, h1, h2);

    for (int i = 0; i < n; ++i){
        cout<<h1[i]<<' ';
    }

    cout<<endl;

    for (int i = 0; i < n; ++i){
        cout<<h2[i]<<' ';
    }

    return 0;
}