#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n][n], x = 0, c = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      a[i][j] = x + 1;
      x++;
    }
  }
  int i = 0, j = 0;
  while (c < n * n) {
    cout << a[i % n][j % n] << " ";
    i++;
    j++;
    c++;
    if (i == n) {
      cout << "\n";
      i = 0;
      j = (c + 1) / n;
    }
  }
}
