#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { ll n; cin >> n; vector> a(n, vector(n)); for (ll i = 0; i < n; i++) { for (ll j = 0; j < n; j++) { a[i][j] = (i+j)%n + 1; } } for (auto x : a){ string delim = ""; for (auto y : x){ cout << delim << y; delim = " "; } cout << "\n"; } }