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:
/**
* http://codeforces.com/contest/710/problem/C
*
* 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
*
**/

/**
*E O E
*O O O
*E O E
*
*E E O E E
*E O O O E
*O O O O O 
*E O O O E
*E E O E E
*
*E E E O E E E
*E E O O O E E
*E O O O O O E
*O O O O O O O
*E O O O O O E
*E E O O O E E
*E E E O E E E
*
**/

import java.io.*;
import java.util.*;

public class q3 {

	public static int[] odd;
	public static int[] even;
	public static int odd_index;
	public static int even_index;

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine().trim());

		if ( n == 1 ) {
			System.out.println("1");
		}
		else if ( n % 4 == 3) {
			populate(n);
			print(n);
		}
		else if ( n % 4  == 1) {
			populate(n);
			print(n);
		}
	}

	public static void populate(int n) {
		odd = new int[(n * n + 1) / 2];
		even = new int[(n * n+ 1) / 2 - 1];
		odd_index = 0;
		even_index = 0;

		for ( int i = 1; i <= n * n; i+=2 ) {
			odd[odd_index] = i;
			odd_index++;
		}
		odd_index = 0;
		for ( int i = 2; i <= n * n; i+=2 ) {
			even[even_index] = i;
			even_index++;
		}
		even_index = 0;
	}

	public static void print(int n) {
		int number_of_odd = 1;
		int number_of_even = 0;
		boolean toggle = false;
		for ( int i = 0; i < n; i++ ) {

			if ( number_of_odd == n ) {
				toggle = true;
			}
			number_of_even = (n - number_of_odd) / 2;
			
			for ( int j = 0; j < number_of_even; j++) {
				System.out.print(even[even_index] + " ");
				even_index++;
			}
			for ( int j = 0; j < number_of_odd; j++) {
				System.out.print(odd[odd_index] + " ");
				odd_index++;
			}
			for ( int j = 0; j < number_of_even; j++) {
				System.out.print(even[even_index] + " ");
				even_index++;
			}
			System.out.println();
			if ( toggle ) {
				number_of_odd -= 2;
			}
			else {
				number_of_odd += 2;	
			}
		}
	}
}