#include
using namespace std;
int main()
{
int **array;
int i, j, k, n, x = 1, y = -1, flag = 0;
cin >> n;
array = new int*[n];
for(i = 0; i < n; i++)
array = new int[n];
for(i = 0, j = 0, k = 0; i < n * n; i++)
{
if(j < 0)
{
j = 0;
flag = 1;
x = 1;
y = -1;
}
else if(j >= n)
{
if(k < 0)
k = 1;
else
k += 2;
j = n - 1;
y = 1;
x = -1;
}
if(k < 0)
{
k = 0;
x = -1;
y = 1;
}
else if(k >= n)
{
if(flag)
j++;
else
j += 2;
k = n - 1;
x = 1;
y = -1;
}
array[j][k] = i + 1;
j += x; //选择行缩进方式
k += y; //选择列缩进方式
flag = 0;
}
for(j = 0; j < n; j++)
{
for(k = 0; k < n; k++)
cout |