#include <iostream>

using namespace std;
       
int main(){

  freopen("F.in", "r", stdin); 
  freopen("F.out", "w", stdout);

  int n;
  cin >> n;

  int a[n][n];

  int x = n / 2; 
  int y = n / 2;

  int nn = n*n;

  int dir = 0;

  int stepcount = 1;
  int step = 0;
  int counter = 0;

  for(int i = 1; i <= nn; i++)
  {
    
    a[y][x] = i;


    if (dir == 0)
      x++;
    else if (dir == 1)
      y--;
    else if (dir == 2)
      x--;
    else
      y++;
    
    step++;

    if (step == stepcount)
    {
      step = 0;
      if(dir == 3)
        dir = 0;
      else dir++;

      if (counter == 0)
        counter++;
      else
      {
        stepcount++;
        counter = 0;
      }
    }
  }

for (int j = 0; j < n; j++)
  {
  for (int i = 0; i < n - 1; i++)

     {
       cout << a[j][i] << " "; 
     }                     
   cout << a[j][n-1] << endl;
  }  
  
  return 0;
}

