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 a = 1; a < n; a++) {
        	for (int b = 1; b < n; b++) {
        		int minMoves = knightL(a, b, n);
        		System.out.print(minMoves);
        		System.out.print(b==n-1 ? "" : " ");
        	}
        	System.out.println();
		}
        
        in.close();
		
	}
	
	protected static int knightL(int a, int b, int n) {
		boolean visited [][] = new boolean [n][n];
		return move(0, 0, a, b, visited, n, 0);
	}
	
	private static int move(int row, int col, int a, int b, boolean[][] visited, int n, int moves) {
		
		boolean outOfBounds = row>=n || col>=n || row<0 || col<0;
		if ( outOfBounds || visited[row][col] ) {
			return -1;
		}
		
		if (row==(n-1) && col==(n-1)) {
			return moves;
		}
		
		visited[row][col] = true;
		moves++;
		
		int [] check = {-1,-1,-1,-1,-1,-1,-1,-1};
		check[0] = move(row+a, col+b, a, b, visited, n, moves);
		check[1] = move(row-a, col+b, a, b, visited, n, moves);
		check[2] = move(row+a, col-b, a, b, visited, n, moves);
		check[3] = move(row-a, col-b, a, b, visited, n, moves);
		
		if (a != b) {
			check[4] = move(row+b, col+a, a, b, visited, n, moves);
			check[5] = move(row-b, col+a, a, b, visited, n, moves);
			check[6] = move(row+b, col-a, a, b, visited, n, moves);
			check[7] = move(row-b, col-a, a, b, visited, n, moves);
		}
		
		Arrays.sort(check);
		
		for (int i = 0; i < check.length; i++) {
			if (check[i]>0 ) {
				return check[i];
			}
		}

		return -1;
		
	}

}