#include <bits/stdc++.h>
typedef long long ll;
#define M 1000000007
using namespace std;
int calc(double i, double j) {
return ceil(max(max(i / 2, j / 2), (i+j)/3));
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
table[101][101];
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (i == j && i == 0) continue;
if (i + j == 1) table[i][j] = 3;
else if (i == j && i == 2) table[i][j] = 4;
else {
table[i][j] = m(i, j) + m(i,j) % 2;
}
}
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cout << table[i][j] << " ";
}
cout << endl;
}
return 0;
}