#include using namespace std; int main() { int N; cin >> N; vector V(N, 0); for (int i = 0; i < N; i++) V.at(i) = i + 1; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) cout << V.at(j) << ((j == N - 1) ? "\n" : " "); rotate(V.begin(), V.begin() + 1, V.end()); } }