#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 100;
const long long MOD = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  vector<long long> grps[n + 1];
  long long co = 1;
  for (int i = (n + 1); i <= (n * n); i++) {
    grps[co].push_back(i);
    if (i % n == 0) co++;
  }
  long long sz = 300 * 300 + 10;
  bool done[sz];
  for (int i = 0; i < sz; i++) done[i] = false;
  for (int i = 1; i <= n; i++) {
    cout << i << " ";
    for (int j = 1; j <= (n - 1); j++) {
      long long idx = -1;
      for (auto x : grps[j]) {
        if (done[x]) continue;
        if (j % 2) {
          idx = max(idx, x);
        } else {
          idx = x;
          break;
        }
      }
      done[idx] = true;
      cout << idx << " ";
    }
    cout << endl;
  }
}
int main() {
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
