#include <algorithm>
#include <iostream>
using namespace std;
int N;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;

  if (N == 2) { cout << -1 << endl; return 0; }
  if (N % 2 == 1) {
    for (int j = 0; j < N; ++j) {
      for (int k = 0; k < N-1; ++k) {
        if (k > 0) { cout << ' '; }
        cout << (j+k+1) % N + 1;
      } cout << endl;
    }
    return 0;
  }

  for (int j = 0; j < N/2; ++j) {
    for (int k = 0; k < N-1; ++k) {
      if (k > 0) { cout << ' '; }
      cout << (j+k+1)%N+1;
    }
    cout << endl;
  }
  for (int j = N/2; j < N; ++j) {
    for (int k = 0; k < N-1; ++k) {
      if (k > 0) { cout << ' '; }
      if (k == N/2-1) { cout << (j+N/2+1)%N + 1; }
      else if (k == N/2) { cout << (j+N/2)%N + 1; }
      else { cout << (j+k+1)%N+1; }
    }
    cout << endl;
  }

  return 0;
}