import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[][] array=new int[n][n]; int p=0,q=n-1,count=1; while (count<=n*n) { for (int i=p;i<=q;i++) array[p][i]=count++; for (int i=p+1;i<=q;i++) array[i][q]=count++; for (int i=q-1;i>=p;i--) array[q][i]=count++; for (int i=q-1;i>=p+1;i--) array[i][p]=count++; p++; q--; } for(int[] a:array) { for(int i:a) System.out.print(i+ " "); System.out.println(); } } }