#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> nums;
  for (int i = 1; i <= n * n; i++) {
    nums.push_back(i);
  }
  int ini = 0, fim = nums.size() - 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < n / 2; j++) {
      cout << nums[ini + j] << " ";
    }
    for (int j = 0; j < n / 2; j++) {
      cout << nums[fim - j] << " ";
    }
    ini += n / 2;
    fim -= n / 2;
    cout << endl;
  }
  return 0;
}
