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:
// MagicSquare.java
import java.util.Scanner;
public class MagicSquare
{
	public static void main(String[] args)
	{
	Scanner input = new Scanner(System.in);
	int i,j,even,odd,counter,n;
	n=3;
	odd=3;
	even=2;
	int x = input.nextInt();
	int[][] array = new int[ x+1][ x+1];
	
	int c = x/2 + 1;
	array[c][c]=1;
	for( n = 3; n <= x; n = n+2)//for loop 4
	{

	

	for(i = c; i <= c+n/2; i++)// for loop 2
	{

	for(j= c; j<= c+n/2;j++)// for loop 3
	{

	if(i == c && j == c)
	continue;
	if(i == c+n/2)
	{
		if(j != c)
		{
		array[i][j]=even;
		even=even+2;
		}
		else
		{
		array[i][j]=odd;
		odd=odd+2;
		}
	}
	if( j== c+n/2 && i != c+n/2)
	{
	array[i][j]=odd;
	odd=odd+2;
	}
	
	
	}//end for loop 2
	}//end for loop 3
	
	

	for(i = c; i >= c-n/2; i--)// for loop 2
	{

	for(j= c; j>= c-n/2;j--)// for loop 3
	{

	if(j>=c && i >=c)
	continue;
	
	if(i == c-n/2)
	{
		if(j != c)
		{
		array[i][j]=even;
		even=even+2;
		}
		else
		{
		array[i][j]=odd;
		odd=odd+2;
		}
	}
	
	if( j== c-n/2 && i != c-n/2)
	{
	array[i][j]=odd;
	odd=odd+2;
	}
	
	}//end for loop 2
	}//end for loop 3

	for(i = c+1; i <= c+n/2; i++)// for loop 2
	{

	for(j= c-1; j>= c-n/2;j--)// for loop 3
	{

	
	if(i == c+n/2)
	{
		
		
	
		
		
		array[i][j]=even;
		even=even+2;
		
		
	}
	if(j==c-n/2 && i<c+n/2)
	{
	array[i][j]=odd;
	odd=odd+2;
	}
	
	}//end for loop 2
	}//end for loop 3

	for(i = c-1; i >= c-n/2; i--)// for loop 2
	{

	for(j= c+1; j<= c+n/2;j++)// for loop 3
	{

	
	if(i == c-n/2)
	
		
	{
	array[i][j]=even;
	even=even+2;
	}
		
	
	if( j== c+n/2 && i > c-n/2)
	{
	array[i][j]=odd;
	odd=odd+2;
	}
		
	
	
	
	}//end for loop 2
	}//end for loop 3



	
	}//end for loop 4


	System.out.println();
	for(i=1;i<=x;i++)
	{
	for(j=1;j<=x;j++)
	{
	System.out.printf(" %3d ",array[i][j]);
	}
	System.out.println();
	}



	}// end method main
	}//end class MagicSquare