//g++ -std=c++11 -O2 -Wall microwave.cpp -o microwave
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
//COMMENCE CODE
int gayarray[101][101];
for(int x = 1; x <= 100; x++)
{
if(x % 4 == 0)
{
int i = 1;
for(int y = x; y <= 96;)
{
gayarray[x][y] = i;
gayarray[y][x] = i;
i++;
gayarray[x][y-1] = i;
gayarray[y-1][x] = i;
i++;
gayarray[x][y-2] = i;
gayarray[y-2][x] = i;
i++;
gayarray[x][y-3] = i;
gayarray[y-3][x] = i;
i++;
y += 4;
}
}
else if(x % 3 == 0)
{
int i = 1;
for(int y = x; y <= 97;)
{
gayarray[x][y] = i;
gayarray[y][x] = i;
i++;
gayarray[x][y+1] = i;
gayarray[y+1][x] = i;
i++;
gayarray[x][y-2] = i;
gayarray[y-2][x] = i;
i++;
gayarray[x][y-1] = i;
gayarray[y-1][x] = i;
i++;
y += 4;
}
}
else if(x % 2 == 0)
{
int i = 1;
for(int y = x; y <= 98;)
{
gayarray[x][y] = i;
gayarray[y][x] = i;
i++;
gayarray[x][y-1] = i;
gayarray[y-1][x] = i;
i++;
gayarray[x][y+2] = i;
gayarray[y+2][x] = i;
i++;
gayarray[x][y+1] = i;
gayarray[y+1][x] = i;
i++;
y += 4;
}
}
else
{
for(int y = x; y <= 99;)
{
gayarray[x][y] = y - x + 1;
gayarray[y][x] = gayarray[x][y];
y++;
}
}
}
//Ask table size
int n;
cin >> n;
//print
for(int y = 1; y <= n; y++)
{
for(int x = 1; x <= n; x++)
{
printf("%d ", gayarray[x][y]);
}
printf("\n");
}
}