import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] arr =new int[n][n];
int q = 1;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
arr[i][j] = q;
q++;
}
}
for(int i = 0; i < n; i++) {
if(i%2!=0) {
for(int j = 0; j < n/2-1; j++) {
int desk = 0;
desk = arr[i][j];
arr[i][j] = arr[i][n-j];
arr[i][n-j] = desk;
}
}
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
System.out.print(arr[i][j]);
}
System.out.println();
}
sc.close();
}
}
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] arr =new int[n][n];
int q = 1;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
arr[i][j] = q;
q++;
}
}
for(int i = 0; i < n; i++) {
if(i%2!=0) {
for(int j = 0; j < n/2-1; j++) {
int desk = 0;
desk = arr[i][j];
arr[i][j] = arr[i][n-j];
arr[i][n-j] = desk;
}
}
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
System.out.print(arr[i][j]);
}
System.out.println();
}
sc.close();
}
}