#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, a, b) for(int i = a; i < b; i++) #define all(x) (x).begin(),(x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) typedef long long ll; using P = pair; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; } int main(){ int n; cin >> n; vector a(n); rep(i,n){ a[(i+i) % n] = i+1; } rep(i,n){ int num = 0, j = i; while(num < n){ printf("%d%c", a[j], num == n-1 ? '\n' : ' '); j++; j %= n; num++; } } return 0; }