#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector> X(N, vector(N, 0)); for (int i = 0; i < N; i++) { X[i][i] = i; int cur = 0; for (int j = 0; j < N; j++) { if (j == i) { X[i][j] = i; } else { X[i][j] = cur; } cur++; } } for (auto x : X) { for (const auto& e : x) { cout << e + 1 << (&e == &x.back() ? '\n' : ' '); } } return 0; }