#include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int n;
  int masu[16][16];
  while(cin >> n,n){

    for(int i = 0 ; i < n+1 ; i++){
      for(int j = 0 ; j < n+1 ; j++){
	masu[i][j] = 0;
      }
    }

    int posx = n/2 + 1,posy = n/2;

    masu[posx][posy] = 1;

    for(int i = 2 ; i <= n*n;){
      posx += 1;
      posy += 1;
      if(masu[posx][posy] == 0 ){
	if(posy >= n){masu[posx][posy] = 0;posy = 0;}
	if(posx >= n){masu[posx][posy];posx = 0;}
	if(posy < 0){masu[posx][posy];posy = n-1;}
	if(posx < 0){masu[posx][posy] = 0;posx = n-1;}
	if(masu[posx][posy] != 0)goto b;
	masu[posx][posy] = i++;

      } else {
      b:
	posx+=1;
	posy-=1;
	if(posy >= n){masu[posx][posy] = 0;posy = 0;}
	if(posx >= n){masu[posx][posy];posx = 0;}
	if(posy < 0){masu[posx][posy];posy = n-1;}
	if(posx < 0){masu[posx][posy] = 0;posx = n-1;}
	if(masu[posx][posy] != 0)continue;
	else masu[posx][posy] = i++;


      }
    }
	for(int i = 0 ; i < n ; i++){
	  for(int j = 0 ; j < n ; j++){
	    printf("%4d",masu[posx][posy]);
	  }
	  cout << endl;
	}

  }
}