#include <stdio.h>

int main(int argc, char **argv)
{
	int n, **a, i, j, t=0;
	
	while(1){
		scanf("%d", &n);
		if(n == 0){
			break;
		}
		
		a = (int **)calloc(n, sizeof(int));
		for(i = 0; i < n; i++){
			a[i] = (int *)calloc(n, sizeof(int));
		}
		
		i = n/2+1;
		j = n/2;
		t = 1;
		while(t <= n*n){
			if(a[i][j] != 0){
				i++;
				j--;
			} else {
				a[i++][j++] = t++;
			}
			if(n == i){
				i = 0;
			}
			if(n == j){
				j = 0;
			} else if(j < 0){
				j = n-1;
			}
		}
		
		for(i = 0; i < n-1; i++){
			printf("%4d", a[i][0]);
			for(j = 1; j < n; j++){
				printf("%4d", a[i][j]);
			}
			printf("\n");
		}
		
		for(i = 0; i < n; i++){
			free(a[i]);
		}
		
		free(a);
	}
	
	return 0;
}