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
        //System.out.println("n = "+n);
        int[][]solutie = new int[n][n];
        for(int i=1;i<solutie.length;i++){
        	for(int j=1;j<solutie[0].length;j++){
        		//System.out.print("("+i+","+j+")  ");
        		System.out.print(numberOfMoves(i,j,n)+" ");
        	}
        	System.out.println();
        }
    }
    
    static int numberOfMoves(int i,int j,int n){
    	
    	HashSet<Node> exploredSet = new HashSet<>();
		ArrayDeque<Node> fringe = new ArrayDeque<>();
		Node currentNode = new Node(0,0,null);
		Node solution = null;
		fringe.add(currentNode);
		int  solutionRow = n-1;
		while (fringe.size() > 0) {
			currentNode = fringe.removeFirst();
			//nodesEncountered.add(currentNode);
			exploredSet.add(currentNode);
			if (currentNode.row == solutionRow && currentNode.column==solutionRow) {
				solution = currentNode;
				break;
			} else {
				Node tmpNode = null;
				// UP LEFT
				if (currentNode.row - i >= 0 && currentNode.column-j>=0) {
					tmpNode = new Node(currentNode.row - i, currentNode.column-j, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
				if (currentNode.row - j >= 0 && currentNode.column-i>=0) {
					tmpNode = new Node(currentNode.row - j, currentNode.column-i, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
				// UP RIGHT
				if (currentNode.row-i>=0&&currentNode.column + j < n ) {
					tmpNode = new Node(currentNode.row-i, currentNode.column +j, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
				if (currentNode.row-j>=0&&currentNode.column + i < n ) {
					tmpNode = new Node(currentNode.row-j, currentNode.column +i, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
				// DOWN LEFT
				if (currentNode.row+i<n &&currentNode.column - j >=0 ) {
					tmpNode = new Node(currentNode.row+i, currentNode.column -j, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
				if (currentNode.row+j<n &&currentNode.column - i >=0 ) {
					tmpNode = new Node(currentNode.row+j, currentNode.column -i, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
				// DOWN RIGHT
				if (currentNode.row + i < n && currentNode.column +j < n) {
					tmpNode = new Node(currentNode.row + i, currentNode.column + j, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}

				if (currentNode.row + j < n && currentNode.column +i < n) {
					tmpNode = new Node(currentNode.row + j, currentNode.column + i, currentNode);
					if (!exploredSet.contains(tmpNode)) {
						exploredSet.add(tmpNode);
						fringe.add(tmpNode);
					}
				}
			}
		}
		if(solution == null){
    	
    	 return -1;
		}
		else{
			return solution.getRootToNodePath().size()-1;
		}
    }
    static class Node{
		private final Node parent;
		private final int row;
		public int getRow() {
			return row;
		}
		public int getColumn() {
			return column;
		}
		private final int column;
		public Node(int row, int column,Node parent) {
			super();
			this.row = row;
			this.column = column;
			this.parent = parent;
		}
		public Node getParent(){
			return parent;
		}
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + column;
			result = prime * result + row;
			return result;
		}
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Node other = (Node) obj;
			if (column != other.column)
				return false;
			if (row != other.row)
				return false;
			return true;
		}
		
		public List<Node>getRootToNodePath(){
			
			ArrayList<Node>retList = new ArrayList<Node>();
			retList.add(this);
			Node parent = this.parent;
			while(parent!=null){
				retList.add(parent);
				parent = parent.parent;
			}
			Collections.reverse(retList);
			return retList;
			
		}
		
	}
}