import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        // your code goes here
        
        

        
        
        for (int i = 1; i < n; i++) {
            for (int j = 1; j < n; j++) {
                boolean[][] visited = new boolean[n][n];
                LinkedList<Integer> currXqueue = new LinkedList<Integer>();
                LinkedList<Integer> currYqueue = new LinkedList<Integer>();
                LinkedList<Integer> costQueue = new LinkedList<Integer>();
                currXqueue.add(0);
                currYqueue.add(0);
                costQueue.add(0);
                visit(currXqueue, currYqueue, costQueue, i, j, visited);
                System.out.print(" ");
            }
            System.out.print('\n');
        }
    }
    
    public static void visit(LinkedList<Integer> currXqueue, LinkedList<Integer> currYqueue, LinkedList<Integer> costQueue, int i, int j, boolean[][] visited) {
        while (!currXqueue.isEmpty()) {

            int currX = currXqueue.poll();
            int currY = currYqueue.poll();
            int cost = costQueue.poll();
            if (currX == visited.length-1 && currY == visited.length -1) {
                System.out.print(cost);
                return;
            }
            visited[currX][currY] = true;
            cost++;

            if (currX - i >= 0 && currY - j >=0 && !visited[currX-i][currY-j]) {
                currXqueue.add(currX-i);
                currYqueue.add(currY-j);
                costQueue.add(cost);
            }
            if (currX - j >= 0 && currY - i >=0 && !visited[currX-j][currY-i]) {
                currXqueue.add(currX-j);
                currYqueue.add(currY-i);
                costQueue.add(cost);
            }
            if (currX - i >= 0 && currY + j < visited.length && !visited[currX-i][currY+j]) {
                currXqueue.add(currX-i);
                currYqueue.add(currY+j);
                costQueue.add(cost);
            }
            if (currX - j >= 0 && currY + i < visited.length && !visited[currX-j][currY+i]) {
                currXqueue.add(currX-j);
                currYqueue.add(currY+i);
                costQueue.add(cost);
            }
            if (currX + i < visited.length && currY + j < visited.length && !visited[currX+i][currY+j]) {
                currXqueue.add(currX+i);
                currYqueue.add(currY+j);
                costQueue.add(cost);
            }
            if (currX + j < visited.length && currY + i < visited.length && !visited[currX+j][currY+i]) {
                currXqueue.add(currX+j);
                currYqueue.add(currY+i);
                costQueue.add(cost);
            }
            if (currX + i < visited.length && currY - j >= 0 && !visited[currX+i][currY-j]) {
                currXqueue.add(currX+i);
                currYqueue.add(currY-j);
                costQueue.add(cost);
            }
            if (currX + j < visited.length && currY - i >= 0 && !visited[currX+j][currY-i]) {
                currXqueue.add(currX+j);
                currYqueue.add(currY-i);
                costQueue.add(cost);
            }
        }
        System.out.print(-1);
        return;
    }
}