Problem: Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.

Input

The only line contains odd integer n (1 ≤ n ≤ 49).

Output

Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.

Examples

Input

1


Output

1


Input

3


Output

2 1 4
3 5 7
6 9 8

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class Main {
	
	
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
	   int n=sc.nextInt();
	 if(n!=1){
		 int[][]arr=new int[n][n];
		 int odd=1;
		 int oddcnt=2*n-1;int evencnt=0;
		 int even=2;
		for (int i = 0; i < arr.length; i++) {
			arr[n/2][i]=odd;
		
			odd+=2;
			if(i!=(n/2))
			{
				arr[i][n/2]=odd;odd+=2;
				
			}
            
		}
		
		
		

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if(arr[i][j]==0){
					if(oddcnt<=n*n/2){
						
						arr[i][j]=odd;
						odd+=2;
						arr[i][n-j-1]=odd;odd+=2;
						arr[n-i-1][j]=odd;odd+=2;
						int tmp1=i;int tmp2=n-j-1;
						arr[n-tmp1-1][tmp2]=odd;odd+=2;
						oddcnt+=4;
						
						
						
					}else
						
						
						
						if(evencnt<n*n/2){
							arr[i][j]=even;
							even+=2;
							arr[i][n-j-1]=even;even+=2;
							arr[n-i-1][j]=even;even+=2;
							int tmp1=i;int tmp2=n-j-1;
							arr[n-tmp1-1][tmp2]=even;even+=2;
							evencnt+=4;
							
							
							
						}
					
					
					
			
				}
				
			}
		}
	
	
		 for (int i = 0; i < arr.length; i++) {
				for (int j = 0; j < arr.length; j++) {
				out.print(arr[i][j]);	
				
				if(j!=n-1)out.print(" ");
				else
					out.println();
				}
				}
		/*for (int i = 0; i < arr.length; i++) {
			out.println(Arrays.toString(arr[i]));
		}*/
				
				
	 }else
		 out.println(1);
	
	   
	  		out.flush();
		
		
		
	}
	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;
		
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}
		
		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}
		
		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}
		
		public boolean ready() throws IOException {return br.ready();}


	}
}