#include using namespace std; typedef int64_t Int; #define all(x) (x).begin(), (x).end() const double EPS = 1e-10; const Int INF = 1e18; const int inf = 1e9; const Int mod = 1e9+7; bool print_space_enable = false; void print() { cout << '\n'; print_space_enable = false; } template void print(Head&& head, Tail&&... tail) { if (print_space_enable) cout << " "; cout << fixed << setprecision(15) << head; print_space_enable = true; print(std::forward(tail)...); } template void print(vector v) { for (size_t i = 0; i < v.size(); i++) { if (i > 0) std::cout << " "; std::cout << v[i]; } std::cout << std::endl; } int main() { Int n; cin >> n; vector a(n); map mp; for (Int i = 0; i < n; i++) { a[i] = n - 1 - i; mp[n - 1 - i] = i; } for (Int i = 0; i < n; i++) { for (Int j = 0; j < n; j++) { Int index = (mp[i] - i + n) % n; cout << a[(index + j) % n] + 1 << " " ; } cout << endl; } return 0; }