#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int n; 
int **checked;

typedef struct node{
    int i;
    int j;
    int g;
    int h;
    struct node *next;
}node_t;

node_t *head = NULL;
node_t *tail = NULL;


void insert(int i, int j, int g, int h){
    if(checked[i][j]==1) return;
    //printf("Insert: %d %d\n",i,j);
    checked[i][j] = 1;
    node_t *newnode = (node_t*)malloc(sizeof(node_t));
    newnode->i = i;
    newnode->j = j;
    newnode->g = g;
    newnode->h = h;
    newnode->next = NULL;
    if(head==NULL){
        head=newnode;
    }
    else{
        tail->next=newnode;
    }
    tail=newnode;
}

int isEmpty(){
    if(head==NULL){
        return 1;
    }
    else return 0;
}

node_t *dequeue(){
    node_t *ret;
    ret = head;
    head = head->next;
    return ret;
}

void testone(int i, int j,int g){
    if(i<0) return;
    if(i>=n) return;
    if(j<0) return;
    if(j>=n) return;
    
    insert(i,j,g,0);
}

void initchecked(){
    int i,j;
    for(i=0; i<n; i++){
        for(j=0; j<n; j++){
            checked[i][j] = 0;
        }
    }
}

void Astro(int a, int b){
    node_t *node;
    
    tail = NULL;
    head = NULL;
    
    initchecked();
    insert(0,0,0,0);
    while(!isEmpty()){
        node = dequeue();
        //printf("Test: %d %d\n",node->i, node->j);
        if(node==NULL){
            printf("-1 ");
            return ;
        }
        else if(node->i==n-1 && node->j==n-1){
            printf("%d ",node->g);
            return ;
        }
        
        testone(node->i - b, node->j + a, node->g+1);
        testone(node->i - a, node->j + b, node->g+1);
        testone(node->i + a, node->j + b, node->g+1);
        testone(node->i + b, node->j + a, node->g+1);
        
        
        testone(node->i - b, node->j - a, node->g+1);
        testone(node->i - a, node->j - b, node->g+1);
        testone(node->i + a, node->j - b, node->g+1);
        testone(node->i + b, node->j - a, node->g+1);
    }
    printf("-1 ");
}

int main(){
    scanf("%d",&n);
    checked = (int **)malloc(n*sizeof(int *));
    for(int i=0; i<n; i++){
        checked[i] = (int *)malloc(n*sizeof(int *));
    }
    
    for(int i=1; i<=n-1; i++){
        for(int j=1; j<=n-1; j++){
            Astro(i,j);
        }
        printf("\n");
    }
    return 0;
}