#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000"]
#pragma GCC optimize("Ofast"]
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native"]
using namespace std;
signed main() {
  long long int n;
  cin >> n;
  long long int next = 0;
  long long int step = 1;
  vector<vector<long long int>> blocks(n);
  for (long long int i = 1; i <= n * n; i++) {
    blocks[next].push_back(i);
    next += step;
    if (next == n) {
      next = n - 1;
      step = -1;
    }
    if (next == -1) {
      next = 0;
      step = 1;
    }
  }
  for (auto i : blocks) {
    for (auto j : i) cout << j << " ";
    cout << "\n";
  }
  return 0;
}
