#include <bits/stdc++.h>

using namespace std;

void solve(){
    int n;
    cin >> n;
    if(n % 2 == 0){
        cout << "-1\n";
        return;
    }
    vector<vector<int>> ans(n, vector<int>(n));
    for(int x = 1; x <= n; ++x){
        int i = x - 1, j = x - 1;
        for(int t = 0; t < n; ++t){
            ans[i][j] = x;
            --i;
            ++j;
            if(i < 0){
                i += n;
            }
            if(j == n) j -= n;
        }
    }
    for(auto x : ans){
        for(auto y : x){
            cout << y << ' ';
        }
        cout << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
#ifdef mtask
    int t;
    cin >> t;
    while(t--)
#endif
    solve();
    // TIP See CLion help at <a href="https://www.jetbrains.com/help/clion/">jetbrains.com/help/clion/</a>. Also, you can try interactive lessons for CLion by selecting 'Help | Learn IDE Features' from the main menu.
}