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

public class Solution {
    
    
    static int[][] board;
    static int n;
    static int[][] directions = {{1,1},{1,-1},{-1,-1},{-1,1}};
    static int[][] result;
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        
        
        // your code goes here
        board = new int[n][n];
        result = new int[n - 1][n - 1];
        for (int[] row : result) {
            Arrays.fill(row, -1);
        }
        for (int i = 1; i < n; i++) {
            for (int j = i; j < n; j++) {
                // consider pair (i,j) 
                // fill board
                for (int[] row : board) {
                    Arrays.fill(row, -1);
                }
                
                board[0][0] = 0;
                //do DFS
                Queue<Coor> queue = new ArrayDeque<>();
                queue.add(new Coor(0, 0));
                while (!queue.isEmpty()) {
                    Coor cur = queue.remove();
                    for (int[] dir : directions) {
                        Coor next = new Coor(cur.x + dir[0] * i, cur.y + dir[1] * j); // i,j
                        if (isValid(next) && board[next.x][next.y] == -1) {
                            board[next.x][next.y] = board[cur.x][cur.y] + 1; // add 1 step
                            queue.add(next);
                        }
                        next =  new Coor(cur.x + dir[0] * j, cur.y + dir[1] * i); // j,i
                        if (isValid(next) && board[next.x][next.y] == -1) {
                            board[next.x][next.y] = board[cur.x][cur.y] + 1; // add 1 step
                            queue.add(next);
                        }
                    }
                    if (board[n - 1][n - 1] != -1) {
                        result[i - 1][j - 1] = board[n - 1][n - 1];
                        result[j - 1][i - 1] = result[i - 1][j - 1];
                        break;
                    }
                }
            }
        }
        
        for (int i = 0; i < result.length; i++) {
            for (int j = 0; j < result.length; j++) {
                System.out.print(result[i][j]);
                if (j != result.length - 1) {
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
    
    private static boolean isValid(Coor c) {
        return c.x >= 0 && c.x < n && c.y >= 0 && c.y < n;
    }
    
    private static class Coor {
        int x;
        int y;
        public Coor(int xx, int yy) {
            x = xx;
            y = yy;
        }
    }
}