#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i, n) for(int(i) = 0; (i) < (n); (i)++) #define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++) #define All(v) (v).begin(), (v).end() #define pb push_back #define MP(a, b) make_pair((a), (b)) using ll = long long; using pii = pair; using pll = pair; const int INF = 1 << 30; const ll LINF = 1LL << 60; const int MOD = 1e9 + 7; int main() { int N; cin >> N; vector> res(N, vector(N)); for(int i = 0; i < N; i++) { for(int j = 2 * i, c = 0; c < N; c++, j += N - 1) { res[i][j % N] = c + 1; } } rep(i, N) { rep(j, N) cout << res[i][j] << (j == N - 1 ? "\n" : " "); } return 0; }