#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

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

    return 0;
}