#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int a[n][n], b[n][n];
int i, j, ck2;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++){
if (i==j){
a[i][j] = 1;
} else {
a[i][j] = 0;
}
b[i][j] = 0;
}
for (i = 1; i < n; i++)
for (j = 1; j <= i; j++){
a[i][j] = a[i-1][j-1] + a[i-j][j]; // P(n,k) == a[i][j]
ck2=j*(j-1)/2; // C(k,2)
ck2=i-ck2; // for Q(n,k) == P(n-C(k,2),k)
if(ck2>=0 && ck2<n){
b[i][j]=a[ck2][j]; // Q(n,k) for positive and less than n integers
} else {
b[i][j]=0; // Q(n,k) otherwise
}
}
for (i = 0; i < n; i++){
int z = 0;
for (j = 0; j < n; j++){
cout << b[i][j] << ' ';
}
cout << "\n" ;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CiAgICBpbnQgbjsKICAgIGNpbiA+PiBuOwoKICAgIGludCBhW25dW25dLCBiW25dW25dOwogICAgaW50IGksIGosIGNrMjsKCiAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKQogICAgCWZvciAoaiA9IDA7IGogPCBuOyBqKyspewogICAgCQlpZiAoaT09ail7CgkJCQlhW2ldW2pdID0gMTsKICAgIAkJfSBlbHNlIHsKCQkJCWFbaV1bal0gPSAwOwogICAgCQl9CiAgICAgICAgCWJbaV1bal0gPSAwOwoJCX0KICAgIGZvciAoaSA9IDE7IGkgPCBuOyBpKyspCiAgICAJZm9yIChqID0gMTsgaiA8PSBpOyBqKyspewoJCQlhW2ldW2pdID0gYVtpLTFdW2otMV0gKyBhW2ktal1bal07CS8vIFAobixrKSA9PSBhW2ldW2pdCgkJCWNrMj1qKihqLTEpLzI7CQkJCQkJLy8gQyhrLDIpIAoJCQljazI9aS1jazI7CQkJCQkJCS8vIGZvciBRKG4saykgPT0gUChuLUMoaywyKSxrKQoJCQlpZihjazI+PTAgJiYgY2syPG4pewoJCQkJYltpXVtqXT1hW2NrMl1bal07CQkJCS8vIFEobixrKSBmb3IgcG9zaXRpdmUgYW5kIGxlc3MgdGhhbiBuIGludGVnZXJzCgkJCX0gZWxzZSB7CgkJICAgIAliW2ldW2pdPTA7CQkJCQkJLy8gUShuLGspIG90aGVyd2lzZQogICAgCQl9CiAgICAJfQoKICAgIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspewogICAgCWludCB6ID0gMDsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgbjsgaisrKXsKICAgICAgICAJY291dCA8PCBiW2ldW2pdIDw8ICcgJzsKICAgICAgICB9CiAgICAJY291dCA8PCAiXG4iICAgIDsKICAgIH0KICAgIHJldHVybiAwOwp9