#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define MOD 998244353
#define fi first
#define se second
#define IT vector < int > :: iterator
using namespace std;

const int NR = 2e5 + 10 , oo = 2e9 ;


void pres ()    {
    #ifndef ONLINE_JUDGE
    freopen("date.in", "r", stdin);
   // freopen("date.out", "w", stdout);
    #endif

}

int maxim , a [ 150 ][ 150 ] , n , b [ 150 ][ 150 ] ;

 int main()	{
     int i , j ;
  //  pres();
    cin >> n ;
    if ( n <= 2 ) return cout << -1 , 0 ;
    for ( i = 2 ; i <= n ; ++ i )   {
        a [ 1 ][ i ] = i - 1 ;
    }
    for ( i = 2 ; i <= n ; ++ i )   {
        maxim = 1 ;
        for ( j = 1 ; j < i ; ++ j )    {
            a [ i ][ j ] = a [ j ][ i ] + 1 ;
            if ( a [ i ][ j ] == n )    a [ i ][ j ] = 1 ;
            maxim = a [ i ][ j ];
        }
        maxim ++ ;
        for ( j = i + 1 ; j <= n ; ++ j )   {
            if ( maxim == n )   maxim = 1 ;
            a [ i ][ j ] = maxim ;
            maxim ++ ;
        }
    }

    for ( i = 1 ; i <= n ; ++ i )
    for ( j = 1 ; j <= n ; ++ j )   {
    if ( i == j ) continue ;
    b [ i ][ a [ i ][ j ] ] = j ;

    }

    for ( i = 1 ; i <= n ; ++ i , cout << '\n' )
    for ( j = 1 ; j < n ; ++  j )
    cout << b [ i ][ j ] << ' ' ;
    return 0 ;


}
