import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.Scanner;


public class Main {

	static final String task = "f";
	
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(new FileReader(task+".in"));
		//BufferedReader in = new BufferedReader(new FileReader(task+".in"));
		PrintWriter out = new PrintWriter(new File(task+".out"));
		
			
		int n = in.nextInt();
		int[][] a = new int[n][n];
		
		int x = n-1;
		int y = n-1;
		
		int[] dx = {0,-1,0,1};
		int[] dy = {-1,0,1,0};
		
		int c = n*n;
		int k = 0;
		
		while (c>0)
		{
			a[x][y] = c;
			if (x+dx[k] < 0 || x+dx[k] >= n || y+dy[k] < 0 || y+dy[k] >= n) k++; else
				if (a[x+dx[k]][y+dy[k]] > 0) k++;
			
			k%=4;
			
			x+=dx[k];
			y+=dy[k];
			c--;
			//System.out.println(c+" "+k);
		}
		
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				out.print(a[i][j]+" ");
			}
			out.println();
		}
		
		in.close();
		out.close();
	}

}
