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

import java.awt.Point;

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++) {
                System.out.print(minMoves(n, i, j) + " ");
            }
            System.out.println();
        }
    }
    
    static int minMoves(final int n, final int a, final int b) {
        int[][] distances = new int[n][n];
        final int[] rowMoves = {a, -a,  a, -a, b, -b,  b, -b};
        final int[] colMoves = {b,  b, -b, -b, a,  a, -a, -a};
        for (int[] row : distances) {
            for (int j = 0; j < n; j++) { row[j] = Integer.MAX_VALUE; }
        }
        
        final int S = 2 * n;   // compare seed
        PriorityQueue<Square> visited = new PriorityQueue<>();
        
        distances[0][0] = 0;
        visited.add(new Square(0, 0, 0));
        
        while (!visited.isEmpty()) {
            Square current = visited.remove();
            int nextD = current.distance + 1;
            for (int i = 0; i < 8; i++) {
                int newRow = current.row + rowMoves[i];
                int newCol = current.col + colMoves[i];
                if (0 <= newRow && newRow < n && 0 <= newCol && newCol < n && distances[newRow][newCol] > nextD) {
                    // update
                    distances[newRow][newCol] = nextD;
                    visited.add(new Square(newRow, newCol, nextD));
                }
            }
        }
        
        if (distances[n - 1][n - 1] < Integer.MAX_VALUE) {
            return distances[n - 1][n - 1];
        } else {
            return -1;
        }
    }
}

class Square implements Comparable<Square> {
    int row;
    int col;
    int distance;
    
    Square(int row, int col, int distance) {
        this.row = row;
        this.col = col;
        this.distance = distance;
    }
    
    public int compareTo(Square other) {
        int compare = this.distance - other.distance;
        if (compare != 0) {
            return compare;
        }
        compare = this.row - other.row;
        if (compare != 0) {
            return compare;
        }
        compare = this.col - other.col;
        return compare;
        
    }
}