using namespace std;
int a[20][20];
int main()
{
int n;
cin >> n;
int x = 1;
int i = 0;
int j = 0;
while(x <= n * n)
{
while(a[i][j] == 0 && j < n)
{
a[i][j] = x;
x++;
j++;
}
j--;
i++;
while(a[i][j] == 0 && i < n)
{
a[i][j] = x;
x++;
i++;
}
i--;
j--;
while(a[i][j] == 0 && j >= 0)
{
a[i][j] = x;
x++;
j--;
}
i--;
j++;
while(a[i][j] == 0 && i >= 0)
{
a[i][j] = x;
x++;
i--;
}
i++;
j++;
}
for(int i = 0;i < n;i++)
{
for(int j = 0;j < n;j++)
{
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}