#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  vector<long long> v[n + 1];
  vector<long long> x[2];
  x[0].push_back(1);
  for (long long i = n; i >= 2; i--) x[0].push_back(i);
  for (long long i = 2; i <= n; i++) x[1].push_back(i);
  x[1].push_back(1);
  long long row = 0;
  long long cur = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j : x[row]) {
      v[j].push_back(cur);
      cur++;
    }
    row = 1 - row;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j : v[i]) cout << j << " ";
    cout << "\n";
  }
}
