#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res *= a;
      res %= mod;
    }
    a *= a;
    a %= mod;
    n >>= 1ll;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<vector<int> > mat(n, vector<int>(n, -1));
  char dir = 'd';
  int i = 0, j = 0;
  int cnt = 1;
  char last = 'd';
  while (cnt <= n * n) {
    mat[i][j] = cnt;
    if (cnt == n * n) break;
    if (dir == 'd') {
      if (i == n - 1) {
        dir = 'r';
        last = 'd';
        continue;
      }
      i++;
    } else if (dir == 'r') {
      j++;
      if (last == 'd')
        dir = 'u';
      else
        dir = 'd';
    } else if (dir == 'u') {
      if (i == 0) {
        dir = 'r';
        last = 'u';
        continue;
      }
      i--;
    }
    cnt++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << mat[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
