import java.util.Scanner;
public class Test {
/**
* 输出蛇形的图案。(如下所示:)
* 10 11 12 1
* 9 16 13 2
* 8 15 14 3
* 7 6 5 4
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int array[][] = new int[n][n];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
array[i][j] = 0;
int pos = 1;
int x =0,y=n-1;
array[x][y] = pos++;
while(pos<=n*n)
{
//向下填充
while(x+1<n && array[x+1][y]==0)
array[++x][y] = pos++;
//向左填充
while(y-1>=0 && array[x][y-1]==0)
array[x][--y] = pos++;
//向上填充
while(x-1>=0 && array[x-1][y]==0)
array[--x][y] = pos++;
//向右填充
while(y+1<n && array[x][y+1]==0)
array[x][++y] = pos++;
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
System.out.print(array[i][j]+" ");
System.out.println();
}
}
}
public class Test {
/**
* 输出蛇形的图案。(如下所示:)
* 10 11 12 1
* 9 16 13 2
* 8 15 14 3
* 7 6 5 4
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int array[][] = new int[n][n];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
array[i][j] = 0;
int pos = 1;
int x =0,y=n-1;
array[x][y] = pos++;
while(pos<=n*n)
{
//向下填充
while(x+1<n && array[x+1][y]==0)
array[++x][y] = pos++;
//向左填充
while(y-1>=0 && array[x][y-1]==0)
array[x][--y] = pos++;
//向上填充
while(x-1>=0 && array[x-1][y]==0)
array[--x][y] = pos++;
//向右填充
while(y+1<n && array[x][y+1]==0)
array[x][++y] = pos++;
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
System.out.print(array[i][j]+" ");
System.out.println();
}
}
}