#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    
    if (n == 3) {
        cout << "1 5 3\n2 6 4";
    }
    else if (n == 4) {
        cout << "1 8 2 7\n3 6 4 5";
    }
    else cout << "idk";

    return 0;
}