Problem: In order to do some research, n^2 labs are built on different heights of a mountain. Let's enumerate them with integers from 1 to n^2, such that the lab with the number 1 is at the lowest place, the lab with the number 2 is at the second-lowest place, …, the lab with the number n^2 is at the highest place.

To transport water between the labs, pipes are built between every pair of labs. A pipe can transport at most one unit of water at a time from the lab with the number u to the lab with the number v if u > v.

Now the labs need to be divided into n groups, each group should contain exactly n labs. The labs from different groups can transport water to each other. The sum of units of water that can be sent from a group A to a group B is equal to the number of pairs of labs (u, v) such that the lab with the number u is from the group A, the lab with the number v is from the group B and u > v. Let's denote this value as f(A,B) (i.e. f(A,B) is the sum of units of water that can be sent from a group A to a group B).

For example, if n=3 and there are 3 groups X, Y and Z: X = \{1, 5, 6\}, Y = \{2, 4, 9\} and Z = \{3, 7, 8\}. In this case, the values of f are equal to:

  * f(X,Y)=4 because of 5 → 2, 5 → 4, 6 → 2, 6 → 4, 
  * f(X,Z)=2 because of 5 → 3, 6 → 3, 
  * f(Y,X)=5 because of 2 → 1, 4 → 1, 9 → 1, 9 → 5, 9 → 6, 
  * f(Y,Z)=4 because of 4 → 3, 9 → 3, 9 → 7, 9 → 8, 
  * f(Z,X)=7 because of 3 → 1, 7 → 1, 7 → 5, 7 → 6, 8 → 1, 8 → 5, 8 → 6, 
  * f(Z,Y)=5 because of 3 → 2, 7 → 2, 7 → 4, 8 → 2, 8 → 4. 



Please, divide labs into n groups with size n, such that the value min f(A,B) over all possible pairs of groups A and B (A ≠ B) is maximal.

In other words, divide labs into n groups with size n, such that minimum number of the sum of units of water that can be transported from a group A to a group B for every pair of different groups A and B (A ≠ B) as big as possible.

Note, that the example above doesn't demonstrate an optimal division, but it demonstrates how to calculate the values f for some division.

If there are many optimal divisions, you can find any.

Input

The only line contains one number n (2 ≤ n ≤ 300).

Output

Output n lines:

In the i-th line print n numbers, the numbers of labs of the i-th group, in any order you want.

If there are multiple answers, that maximize the minimum number of the sum of units of water that can be transported from one group the another, you can print any.

Example

Input


3


Output


2 8 5
9 3 4
7 6 1

Note

In the first test we can divide 9 labs into groups \{2, 8, 5\}, \{9, 3, 4\}, \{7, 6, 1\}.

From the first group to the second group we can transport 4 units of water (8 → 3, 8 → 4, 5 → 3, 5 → 4).

From the first group to the third group we can transport 5 units of water (2 → 1, 8 → 7, 8 → 6, 8 → 1, 5 → 1).

From the second group to the first group we can transport 5 units of water (9 → 2, 9 → 8, 9 → 5, 3 → 2, 4 → 2).

From the second group to the third group we can transport 5 units of water (9 → 7, 9 → 6, 9 → 1, 3 → 1, 4 → 1).

From the third group to the first group we can transport 4 units of water (7 → 2, 7 → 5, 6 → 2, 6 → 5).

From the third group to the second group we can transport 4 units of water (7 → 3, 7 → 4, 6 → 3, 6 → 4).

The minimal number of the sum of units of water, that can be transported from one group to another is equal to 4. It can be proved, that it is impossible to make a better division.

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
import java.lang.Math;


public class A {
	
	
	public static void main(String args[]) {
		PrintWriter out = new PrintWriter(System.out);
		FastScanner fs = new FastScanner();
		
		int t = 1;
		
		for(int test_case = 1; test_case <= t; test_case++) {
			int cur = 1;
			int n=fs.nextInt();
			int a[][] = new int[n][n];
			
			for(int i = 0; i < n; i++) {
				if(i%2==0) {
					for(int j = 0; j < n; j++, cur++) {
						a[j][i]=cur;
						
					}
				} else {
					for(int j = n - 1; ~j != 0; j--, cur++) {
						a[j][i]=cur;
					}
				}
			}
			for(int i = 0; i < n; i++) {
				for(int j : a[i])
					out.print(j+" ");
				out.println();
			}
		}
		out.close();
	}
	static int pi(char c) {
		return c-'0';
	}
	
	
	
	static class Pair implements Comparable<Pair>{
		int first, second;
		public Pair(int x, int y) {
			first=x;second=y;
		}
		public int compareTo(Pair x) {
			if(this.first<x.first)
				return -1;
			if(this.first==x.first)
				return this.second<x.second?-1:(this.second==x.second?0:1);
			return 1;
		}
	}
	
	
	
	
	static class RangeMin {
		long logs[], st[][];
		int N, K;
		public RangeMin(int n) {
			N=n;
			K = (int)((double) (Math.log10((double)n) /(double) Math.log10((double)2) ));
			st = new long [N+2][K+2];
			logs = new long[N+2];
		}
		void init(ArrayList<Integer> A) {
			
			for(int i = 0; i < N; i++) {
				Arrays.fill(st[i], (long)1e18);
				st[i][0]=(long)A.get(i);
			}
			// NLOGN
			for(int j = 1; j <= K; j++) {
				for(int i = 0; i + (1<<j) <= N; i++) {
					st[i][j]=Math.min(st[i][j-1], st[i + (1 << (j-1))][j-1]);
				}
			}
			logs[1]=0;
			for(int i = 2; i <= N; i++) {
				logs[i]=logs[i/2]+1;
			}
		}

		long query(int L, int R) {
			int j = (int)logs[R-L+1];
			return Math.min(st[L][j], st[R - (1 << j) + 1][j]);
		}
	}
	
	static class FastScanner 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        }
        public int[] nextArray(int n) {
            int a[] = new int[n];
            for(int i =0; i < n; i++) a[i]=this.nextInt();
            return a;
        }
        public int max(int a[]) {
        	int mx = Integer.MIN_VALUE;
        	for(int i : a)
        		mx = Math.max(i, mx);
        	return mx;
        }
        public int count(int a[], int val) {
        	int ans =0;
        	for(int i : a)
        		ans += val == i ? 1 : 0;
        	return ans;
        }
        public int min(int a[]) {
        	int mn = Integer.MAX_VALUE;
        	for(int i : a)
        		mn = Math.min(i, mn);
        	return mn;
        }
        public void randomShuffleSort(int []a) {
			Random r = new Random();
            for(int i =0; i < (a.length)/2; i++) {
                int temp=a[i],p=r.nextInt(a.length);
                a[i]=a[p];
                a[p]=temp;
            }
            this.fine_sort(a);
        }
        public void fine_sort(int a[]) {
            ArrayList<Integer> A = new ArrayList<>();
            for(int i : a) A.add(i);
            Collections.sort(A);
            for(int i=0; i < a.length; i++) {
                a[i]=A.get(i);
            }
        } 
    }
	static class SegmentTree {
    	int leftmost, rightmost;
    	SegmentTree lChild, rChild;
    	int sum;
    	long lz_val;
    	
    	public SegmentTree(int l, int r, int a[]) {
    		leftmost = l;
    		rightmost = r;
    		lz_val=0;
    		if(l == r)
    			sum = a[l];
    		else {
    			int mid = (l + r) / 2;
    			lChild = new SegmentTree(l, mid, a);
    			rChild = new SegmentTree(mid+1, r, a);
    			update();
    		}
    	}
    	public void update() {
    		sum = lChild.sum + rChild.sum + (int)lChild.lz_val + (int)rChild.lz_val;
    	}
    	public void pointUpdate(int pos, int val) {
    		if(leftmost == rightmost) {
    			sum = val;
    		} else {
    			int mid = (leftmost + rightmost) / 2;
    			if(pos <= lChild.rightmost) lChild.pointUpdate(pos, val);
    			else rChild.pointUpdate(pos, val);
    			update();
    		}
    	}
    	public void rangeUpdate(int l, int r, int val) {
    		// first check if it's within the range
    		if(l <= leftmost && r >= rightmost) {
    			lz_val += val;
    		} else {
    			// its not within the range so lets update the left if we have to and update the right if we have to
    			if(lChild.rightmost >= l) lChild.rangeUpdate(l, r, val);
    			if(rChild.leftmost <= r) rChild.rangeUpdate(l, r, val);
    			update();
    		}
    	}
    	public long query(int l, int r) {
    		if(l > rightmost || r < leftmost) return 0;
    		else if(l <= leftmost && r >= rightmost) return sum + lz_val;
    		
    		return (long) lChild.query(l, r) + (long) rChild.query(l, r);
    	}
    }
}