#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N;
	while(~scanf("%d", &N)) {
		if(N == 2) {
			puts("-1");
			continue;
		}
		vector<vi> ans(N);
		rep(i, N) rep(j, N) if(i != j)
			ans[i].push_back(j);
		mt19937 re;
		while(1) {
			bool ok = true;
			rep(j, N - 1) {
				rep(i, N) {
					int k = ans[i][j];
					if(ans[k][j] == i) {
						ok = false;
						swap(ans[i][j], ans[i][re() % (N - 1)]);
						swap(ans[k][j], ans[k][re() % (N - 1)]);
						goto break_;
					}
				}
			}
			break_:;
			if(ok) {
				rep(i, N) {
					rep(j, N - 1) {
						if(j != 0) putchar(' ');
						printf("%d", ans[i][j] + 1);
					}
					puts("");
				}
				break;
			}
		}
	}
	return 0;
}
