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.*;
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 x = 0;
		int y = 0;
		x = 1; //# of odd
		boolean toggle = false;
		for ( int i = 0; i < n; i++ ) {

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