#include using namespace std; //#include //using namespace atcoder; using ll = long long; using P = pair; using Pll = pair; using Graph = vector>; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i,n) for(ll i = 1; i <= (n); ++i) #define drep(i,n) for(ll i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (ll i = s; i < (t); ++i) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() void solve(){ int n; cin >> n; vector> a(n,vector(n)); rep(i,n){ rep(j,n){ a[i][j] = (i+j)%n+1; } } rep(i,n){ rep(j,n){ cout << a[i][j] << " "; } cout << endl; } } int main(void){ solve(); return 0; }