#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    if (n == 2) {
        cout << -1 << endl;
        return 0;
    }
    if (n == 3) {
        cout << "2 3" << endl;
        cout << "3 1" << endl;
        cout << "1 2" << endl;
        return 0;
    }
    if (!(n & 1)) { // odd
        for (int i = 0; i < n-1; ++i) {
            for (int j = 1; j < n-1; ++j) {  
                if (i == 0 && j == 1) cout << n;
                else cout << (i + j) % (n-1) + 1;
                cout << " ";
            }
            if (i == 0) cout << 2;
            else cout << n;
            cout << endl;
        }
        for (int i = n - 1; i > 0; --i) {
            if (i != n-1) cout << " ";
            cout << i;
        }
        cout << endl;
    } else { // even
        for (int i = 0; i < n; ++i) {
            for (int j = 1; j < n; ++j) {  
                cout << (i + j) % n + 1;
                if (j != n) cout << " ";
            }
            cout << endl;
        }
    }

    return 0;
}
