import java.io.*;
import java.util.*;

public class Main implements Runnable{
 StreamTokenizer in;
 BufferedReader bin;
 PrintWriter out;
 public static void main(String[] args){
  new Thread(new Main()).start();
 }
 public void run(){
  try{
   bin=new BufferedReader(new FileReader("F.in"));
   in=new StreamTokenizer(bin);
   out=new PrintWriter(new FileWriter("F.out"));
   Locale.setDefault(Locale.US);
   solve();
   out.flush();
  }catch(IOException ex){
   throw new IllegalStateException(ex);
  }
 }
 int nextInt() throws IOException{
  in.nextToken();
  return (int)in.nval;
 }
 int d=0,s,n;
 int curx=0,cury=0;
 int a[][];
 void solve() throws IOException{
  n=nextInt();
  s=n*n;
  a=new int[n][n];
  curx=n;
  cury=n-1;
  p();
  for(int y=0;y<n;y++){
   for(int x=0;x<n;x++)
    out.print(a[y][x]+" ");
    out.println();
  }
 }
 void p(){
  while(s>0){
  switch(d){
   case 0:
    if(curx-1<0 || a[cury][curx-1]>0){
     d=1;
     break;
    }
    curx--;
//    System.out.println("OK"+cury+":"+curx);
    a[cury][curx]=s--;
    break;
   case 1:
    if(cury-1<0 || a[cury-1][curx]>0){
     d=2;
     break;
    }
    cury--;
//    System.out.println("OK1"+cury+":"+curx);
    a[cury][curx]=s--;
    break;
   case 2:
    if(curx+1>=n || a[cury][curx+1]>0){
     d=3;
     break;
    }
    curx++;
//    System.out.println("OK2"+cury+":"+curx);

    a[cury][curx]=s--;
    break;
   case 3:
    if(cury+1>=n || a[cury+1][curx]>0){
     d=0;
     break;
    }
    cury++;
//    System.out.println("OK3"+cury+":"+curx);

    a[cury][curx]=s--;
    break;
  }
  }
 }
}