// #include using namespace std; #define fi first #define se second #define all(x) x.begin(), x.end() #define lch (o << 1) #define rch (o << 1 | 1) typedef double db; typedef long long ll; typedef unsigned int ui; typedef pair pint; typedef tuple tint; const int N = 100 + 5; const int INF = 0x3f3f3f3f; const ll INF_LL = 0x3f3f3f3f3f3f3f3f; int a[N][N]; int main() { ios::sync_with_stdio(0); int n; cin >> n; for (int i = 0; i < n; i++) { int p = i; for (int j = 0; j < n; j++) { a[(i + j) % n][p] = i + 1; p = (p + 2) % n; } } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cout << a[i][j] << " \n"[j == n - 1]; return 0; }