#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (int)(n); i ++) #define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i) using namespace std; using ll = long long; using PL = pair<ll,ll>; using P = pair<int,int>; constexpr int INF = 1000000000; constexpr long long HINF = 1000000000000000; constexpr long long MOD = 1000000007;// = 998244353; constexpr double EPS = 1e-4; constexpr double PI = 3.14159265358979; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; if (N == 1) { cout << 1 << '\n'; return 0; } int now = 1; rep(i,N) { int x = now; cout << x << ' '; rep(j,N - 1) { x += N - 1; if (x > N) x -= N; if (j < N - 2) cout << x << ' '; else cout << x << '\n'; } now += 2; if (now > N) now -= N; } return 0; }