#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

template<typename T>
vector<vector<T>> vec2d(int n, int m, T v){
    return vector<vector<T>>(n, vector<T>(m, v));
}

template<typename T>
vector<vector<vector<T>>> vec3d(int n, int m, int k, T v){
    return vector<vector<vector<T>>>(n, vector<vector<T>>(m, vector<T>(k, v)));
}

template<typename T>
void print_vector(vector<T> v, char delimiter=' '){
    if(v.empty()) {
        cout << endl;
        return;
    }
    for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter;
    cout << v.back() << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; cin >> n;
    vector<int> a, b;
    if(n%3 == 0){
        for(int i = 0; i < n; i++){
            a.push_back(3*i);
            b.push_back(1+3*i);
        }
        for(int i = 0; i < n/3; i++){
            int j = n-i-1;
            a[j] += 3;
        }
    }else if(n%3 == 1){
        int x = 0;
        for(int i = 0; i < n-1; i++){
            while(x == 0 || 3*x == n-1){
                x++;
            }
            a.push_back(x*3);
            b.push_back(x*3+1);
            x++;
        }
        a.push_back(n-1);
        b.push_back(0);
    }else{
        int m = n-2;
        for(int i = 0; i < m; i++){
            a.push_back(3*i);
            b.push_back(1+3*i);
        }
        for(int i = 0; i < m/3+1; i++){
            int j = m-i-1;
            a[j] += 3;
        }

        for(int i = 0; i < m; i++){
            a[i] += 45;
            b[i] += 45;
        }

        a.push_back(3);
        b.push_back(0);

        a.push_back(9);
        b.push_back(15);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    print_vector(a);
    print_vector(b);
    // for(int i = 0; i < n; i++){
    //     for(int j = 0; j < n; j++){
    //         for(int k = 0; k < n; k++){
    //             for(int l = 0; l < n; l++){
    //                 if(a[i]+a[j] == b[k]+b[l]){
    //                     cout << i << ' ' << j << ' ' << k << ' ' << l << endl;
    //                 }
    //             }
    //         }
    //     }
    // }
    // debug_value(accumulate(a.begin(), a.end(), 0));
    // debug_value(accumulate(b.begin(), b.end(), 0));
}