#include <bits/stdc++.h>

#ifndef This_is_Kunteynir
#define dbg(...)
#endif

//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi")

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define len(x) ((int)x.size())

using namespace std;
using ll = long long;
using ld = long double;
using i128 = __int128;

void solve() {
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int> (n));
    if (n == 1) {
        cout << 1;
        return;
    }
    if (n == 2) {
        cout << -1;
        return;
    }
    a[0][0] = 1;
    for (int i = 1; i < n; ++i) {
        a[0][i] = n - i + 1;
    }
    for (int i = 1; i < n; ++i) {
        a[i] = a[i - 1];
        int t = a[i][0];
        for (int j = 1; j < n; ++j) {
            a[i][j - 1] = a[i][j];
        }
        a[i][n - 1] = t;
    }
    for (auto &v : a) {
        for (auto h : v) cout << h << ' ';
        cout << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int _ = 1;
//    cin >> _;
    while (_--) {
        solve();
        cout << '\n';
    }
}
