#include <stdio.h>
#include <tchar.h>
int main()
{
int a[100][100];
FILE *f = fopen("spiral.in", "rt");
int n;
fscanf(f, "%d", &n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
fscanf(f, "%d", &a[i][j]);
fclose(f);
for (int k = 0; k <= n / 2; k++)
{
for (int j = k; j < n - k; j++)
printf("%d ", a[k][j]);
for (int i = k + 1; i < n - k; i++)
printf("%d ", a[i][n - k - 1]);
for (int j = n - k - 2; j >= k; j--)
printf("%d ", a[n - k - 1][j]);
for (int i = n - k - 2; i > k; i--)
printf("%d ", a[i][k]);
}
}