#include <bits/stdc++.h>

using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    if(n == 1){
        cout << 1 << endl << 2;
    }
    else if(n == 2){
        cout << "1 4" << endl << "2 3";
    }
    else if(n == 3){
        cout << "1 6 2" << endl << "3 5 4";
    }
    else if(n == 4){
        cout << "1 8 2 7" << endl << "3 6 4 5";
    }
    else if(n == 5){
        cout << "1 10 2 9 3" << endl << "4 8 5 7 6";
    }
}