#include "pch.h"
#include <iostream>
#include <string.h>
#define maxn 105
int a[maxn][maxn];
int main() {
int n;
scanf_s("%d", &n);
memset(a, 0, sizeof(a));
int i = 2;
int x = 1, y = n;
a[x][y] = 1;
while (i <= n*n) {
while (a[x + 1][y] == 0 && x + 1 <= n)
{ a[++x][y] = i++;}
while (a[x][y - 1] == 0 && y - 1 >= 1)
{ a[x][--y] = i++;}
while (a[x - 1][y] == 0 && x - 1 >= 1)
{ a[--x][y] = i++;}
while (a[x][y + 1] == 0 && y + 1 <= n)
{ a[x][++y] = i++;}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
printf_s("%d\t", a[i][j]);
}
printf_s("\n");
}
}