/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
int n;
Scanner scanIn
= new Scanner
(System.
in);
n = scanIn.nextInt();
int[][] m = new int[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++) {
System.
out.
println(m
[i
][y
] + " "); }
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCWludCBuOwogICAgICAgIAlTY2FubmVyIHNjYW5JbiA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7ICAgICAgICAKICAgICAgICAJCgkJbiA9IHNjYW5Jbi5uZXh0SW50KCk7CiAgICAgICAgCWludFtdW10gbSA9IG5ldyBpbnRbbl1bbl07CiAgICAgICAgCWZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgIAkJCW1baV1baV0gPSAxOwogICAgICAgIAl9CgogICAgICAgIAlmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAJICAgIAkJZm9yKGludCB5ID0gMDsgeSA8IG47IHkrKykgewogICAgICAgICAgICAgICAgCQlTeXN0ZW0ub3V0LnByaW50bG4obVtpXVt5XSArICIgIik7CiAgICAgICAgICAgIAkJfQogICAgICAgICAJCVN5c3RlbS5vdXQucHJpbnRsbigiXG4iKTsKICAgICAgICAJfQoJfQp9