#include <iostream>

using namespace std;

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