#include using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i bool chmin(T& a, T b){ if(a > b){a = b; return true;} return false; } template bool chmax(T& a, T b){ if(a < b){a = b; return true;} return false; } int main(){ int N; cin >> N; rep(i, 0, N){ rep(j, 1, N+1){ int k = j - i + N; cout << (k % N == 0 ? N : k % N); cout << (j == N ? '\n' : ' '); } } return 0; }