#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main(){
  int N;
  cin >> N;
  int X[104][104];
  if(N==2){cout << -1 << endl;return 0;}
  if(false){
    REP(i,N){
      REP(j,N-1){
        cout << (i+j)%N+1 << " ";
      }cout << endl;
    }
  }else{
    REP(i,N){
      REP(j,N-1){
        X[i][j]=j+1;
      }
    }
    REP(i,N){
      X[i][0]=N;
    }
    REP(i,N-1){
      X[i][i]=1;
    }
    X[N-1][0]=1;
    REP(j,N-1){
      X[0][j]=j+2;
    }

    REP(i,N){
      REP(j,N-1){
        if(j!=0){cout << " ";}
        cout << X[i][j];
      }cout << endl;
    }
  }
  return 0;
}
