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.util.Scanner;

public class OddSumMatrix {

	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int sq=n*n;
		int a[][]=new int[n+1][n+1];
		int even[]=new int[sq/2+2];
		int odd[]=new int[sq/2+2];
		int k=1;
		for(int i=1;i<=sq;i=i+2)
		{
			odd[k]=i;
			even[k]=i+1;
			//System.out.println(odd[k]+" "+even[k] );
			k++;
		}
		int l,m,evenIndex=1,oddIndex=1,j;
		for(int i=1;i<=n/2+1;i++)
		{
			l=2*i-1;
			m=n-l;
			//evenIndex=1;oddIndex=1;
			for(j=1;j<=m/2;j++)
			{
				a[i][j]=even[evenIndex++];
			}			
			while(j<=(l+(m/2)))
			{
				a[i][j]=odd[oddIndex++];
				j++;
			}
			while(j<=n)
			{
				a[i][j]=even[evenIndex++];
				j++;
			}
		}	
		int z=n/2+2;
		for(int i=n/2;i>=1;i--)
		{
			l=2*i-1;
			m=n-l;			
			for(j=1;j<=m/2;j++)
			{
				a[z][j]=even[evenIndex++];
			}			
			while(j<=(l+(m/2)))
			{
				a[z][j]=odd[oddIndex++];
				j++;
			}
			while(j<=n)
			{
				a[z][j]=even[evenIndex++];
				j++;
			}
			z++;
		}
		for(int i=1;i<=n;i++)
		{
			for(j=1;j<=n;j++)
			{
				System.out.print(a[i][j]+" ");
			}
			System.out.println();
		}
	}
}