#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 == 2){
        cout << "1 3" << endl << "4 2";
    }
    else if(n == 3){
        cout << "1 6 2" << endl << "3 5 4";
    }
    else if(n == 4){
        cout << "3 8 1 6" << endl << "4 7 2 5";
    }
    else if(n == 5){
        cout << "4 10 1 9 3" << endl << "5 8 2 7 6";
    }
}