#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    printf("%d", i);
    for (int j = 1; j < n; j++) {
      int tmp = (i + j) % n;
      if (tmp == 0) tmp = n;
      printf(" %d", j * n + tmp);
    }
    printf("\n");
  }
  return 0;
}
