#include <iostream>
using namespace std;
int main()
{
int n, a[51][51];
cin >> n;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
if (i == j || i + j == n - 1)
{
a[i][j] = 0;
}
else if (j > i && i + j < n)
{
a[i][j] = 1;
}
else if (j < i && i + j > n - 1)
{
a[i][j] = 3;
}
else if (j < i)
{
a[i][j] = 4;
}
else
{
a[i][j] = 2;
}
}
}
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
cout << a[i][j] << " ";
}
cout << '\n';
}
return 0;
}