#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    if(n == 3)
    {
        cout << "1 6 3" << endl;
        cout << "2 5 4";
    }
    else if (n == 4)
    {
        cout << "4 8 2 5" << endl;
        cout << "3 7 1 5" << endl;
    }
    else if(n == 5)
    {
        cout << "5 10 1 8 3" << endl;
        cout << "4 9 2 7 6";
    }
}