#include using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { cout << i % N + 1 << endl; for (int j = 1; j < N; j++) { cout << " " << (i + j) % N + 1; } cout << endl; } }