#include <iostream>
using namespace std;
int v[6][6];
int main()
{
int n, i, j, a=1, b=1, c;
cin >> n;
v[1][1]=1; v[1][2]=1;
for (j=3; j<=n; ++j)
{
c=a+b; v[1][j]=c; a=b; b=c;
}
for (i=2; i<=n; ++i)
{
if (i%2==0)
for (j=n; j>=1; --j)
{
c=a+b; v[i][j]=c; a=b; b=c;
}
else
for (j=1; j<=n; ++j)
{
c=a+b; v[i][j]=c; a=b; b=c;
}
}
for (i=1; i<=n; ++i)
{
for (j=1; j<=n; ++j)
cout << v[i][j] << " ";
cout << "\n";
}
return 0;
}