#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

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

    return 0;
}