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

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();

		sc.close();
		
		int limit = N*N;
		
		int[][] mat = new int[N][N];
		
		int idx = 0;
		ArrayList<Integer> odd = new ArrayList<>();
		ArrayList<Integer> even = new ArrayList<>();
		
		for(int i = 1 ; i <= N*N ; i+=2){
			odd.add(i);
			if(i!=N*N) even.add(i+1);
		}
		
		for(int i = 0 ; i < N ; i++){
			mat[i][N/2] = odd.get(idx);
			idx++;
		}
		
		for(int i = 0 ; i < N ; i++){
			if(mat[N/2][i] ==0 ){
				mat[N/2][i] = odd.get(idx);
				idx++;
			}
		}
		if(idx < odd.size()){
			int left = odd.size() - idx;
			
			int cols = left/(N-1);
			if(cols%2 == 0){
				for(int i = 0 ; i< N ; i++){
					for(int j = 0 ; j < N ; j++){
						if(mat[i][j] == 0){
							mat[i][j] = odd.get(idx);
							idx++;
						}
					}
					if(idx == odd.size()) break;
				}
				
			}
			else{
				
//				System.out.println(idx + " " + odd.size());
				
				if(idx != (odd.size()-N + 1)){
					for(int i = 0 ; i< N ; i++){
						for(int j = 0 ; j < N ; j++){
							if(mat[i][j] == 0){
								mat[i][j] = odd.get(idx);
								idx++;
							}
						}
						if(idx == (odd.size()- N + 1)) break;
					}
				}
				
//				System.out.println(idx + " " + odd.size() + " left");
				for(int i = N-1 ; i>=0 ; i--){
					for(int j = N-1 ; j >= N/2 ; j--){
						if(mat[i][j] == 0){
							mat[i][j] = odd.get(idx);
							idx++;
						}
					}
					if(idx == odd.size()) break;
				}
				
			}
		}
		
		idx = 0;
		for(int i = 0 ; i < N ; i++){
			for(int j = 0 ; j < N ; j++){
				if(mat[i][j] == 0){
					mat[i][j] = even.get(idx);
					idx++;
				}
			}
		}
		
		for(int i = 0 ; i < N ; i++){
			for(int j = 0 ; j < N ; j++){
				System.out.print(mat[i][j] + " ");
			}
			System.out.println();
		}
		
		
		
	}
}