#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int m[n][n];
for(int i=0;i<n;i++)
{
m[i][i]=1;
}
for(int i=0;i<n;i++)
{
for(int y=0;y<n;y++)
{
if(m[i][y]!=1)
{
m[i][y]=0;
}
}
}
for(int i=0;i<n;i++)
{
for(int y=0;y<n;y++)
{
cout<<m[i][y]<<" ";
}
cout<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbjsKCWNpbiA+PiBuOwogICAgaW50IG1bbl1bbl07CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgewogICAgCW1baV1baV09MTsKICAgIH0KICAgIGZvcihpbnQgaT0wO2k8bjtpKyspCiAgICB7CiAgICAJZm9yKGludCB5PTA7eTxuO3krKykKICAgICAgICB7CiAgICAJICAgIGlmKG1baV1beV0hPTEpCiAgICAJICAgIHsKICAgIAkJICAgIG1baV1beV09MDsKICAgIAkgICAgfQogICAgICAgIH0KICAgIH0KICAgIGZvcihpbnQgaT0wO2k8bjtpKyspCiAgICB7CiAgICAJZm9yKGludCB5PTA7eTxuO3krKykKICAgICAgICB7CiAgICAgICAgCWNvdXQ8PG1baV1beV08PCIgIjsKICAgICAgICB9CiAgICAgICAgY291dDw8IlxuIjsKICAgIH0KICAgIHJldHVybiAwOwp9