#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

int reach(int b[26][26],int n,int i=0,int k=0){
    if(i==n-1&&k==n-1){
        return 1;
    }
    if(i>=n||k>=n||i<0||k<0)
        return -(INT_MAX);
   //cout<<" NOW in "<<i<<" "<<k<<endl;
   if((i+2==n-1||i-2==n-1)&&(k+1==n-1||k-1==n-1))
       return 1;
   if((k+2==n-1||k-2==n-1)&&(i+1==n-1||i-1==n-1))
       return 1;
          b[i][k]=1;      
            
    /*for(int a=0;a<n;a++){
        for(int c=0;c<n;c++)
            cout<<b[a][c];
        cout<<endl;
    }*/
        
    int sa=INT_MAX;
    for(int t=i+2;t>=i-2;t--){
        
        if(t==i+0)
            continue;
         for(int u=k+2;u>=k-2;u--){
           
             if(u==k)
                 continue;
             if(t==i+1&&(u==k+1||u==k-1))
                 continue;
             if(t==i-1&&(u==k+1||u==k-1))
                 continue;
             if(b[t][u]==1)
                 continue;
             if(t==i+2&&(u==k+2||u==k-2))
                 continue;
             if(t==i-2&&(u==k+2||u==k-2))
                 continue;
             /*if(b[t][u]==0)
                 continue;
             cout<<b[t][u];*/
             else{
             int a=reach(b,n,t,u);
            // cout<<" NOW on the other side in "<<i<<" "<<k<<endl;
             if(a<sa&&a>=0)
                 sa=a;}
         }
        }
    //b[i][k]=0;  
    return sa+1;
}

int main(){
    int n;
    cin >> n;
    int i=1,b[26][26]={0};
    while(i<n){
        int j=1;
        while(j<n){
            int count =reach(b,n,i,j);
            if(count>=0)
                cout<<count<<" ";
            else
                cout<<-1<<" ";
            for(int a=0;a<n;a++){
            for(int c=0;c<n;c++)
                b[a][c]=0;}
            j++;
        }
        cout<<endl;
        i++;
    }
    // your code goes here
    return 0;
}