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.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;

public class Q2 {

	static ArrayList<Integer>[] arr;
	static FasterScanner sc;
	static boolean[] b;
	static Stack<Integer> s = new Stack<Integer>();
	//static StringBuilder str;
	public static void main(String[] args) throws IOException {
		sc = new FasterScanner();
		BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
		int n = sc.nextInt();
		int arr[][] = new int[n][n];
		Stack<Integer> odd= new Stack<>();
		Stack<Integer> even= new Stack<>();
		for(int i  = 1;i<=n*n;i++){
			if(i%2 == 1) odd.push(i);
			else even.push(i);
		}
		for(int i =0;i<=n/2;i++){
			boolean x = true;
			int j = n/2;
			int k = 2*i+1;
			int y = 0;
			while(k>0){
				if(x){
				arr[i][j-y] = odd.pop();
				y+=1;
				x = false;
				}
				else {
					x  =true;
					arr[i][j+y] = odd.pop();
				}
				k--;
				
			}
		}
		for(int i =0;i<n/2;i++){
			boolean x = true;
			int j = n/2;
			int k = 2*i+1;
			int y = 0;
			while(k>0){
				if(x){
				arr[n-i-1][j-y] = odd.pop();
				y+=1;
				x = false;
				}
				else {
					x  =true;
					arr[n-1-i][j+y] = odd.pop();
				}
				k--;
				
			}
		}
		for(int i =0 ;i<n;i++){
			for(int j = 0;j<n;j++){
				if(arr[i][j] == 0)
					arr[i][j] = even.pop();
				System.out.print(arr[i][j]+" ");
			}
			System.out.println();
		}
	}
	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	        
	    public int[] nextIntArray(int n) {
	        return nextIntArray(n, 0);
	    }
	    
	    public int[] nextIntArray(int n, int off) {
	    	int[] arr = new int[n + off];
	    	for (int i = 0; i < n; i++) {
	    		arr[i + off] = nextInt();
	    	}
	    	return arr;
	    }
	    
	    public long[] nextLongArray(int n) {
	    	return nextLongArray(n, 0);
	    }
        
		public long[] nextLongArray(int n, int off) {
		    long[] arr = new long[n + off];
		    for (int i = 0; i < n; i++) {
		        arr[i + off] = nextLong();
		    }
		    return arr;
		}

	    private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}