import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static Scanner sc = new Scanner(System.in); public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static long mod = (long)Math.pow(2,29); public static void main(String[] args) throws Exception { int n = sc.nextInt(); int[][] arr = new int[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++) { int val = sc.nextInt(); arr[i][j] = val; } } boolean flag = true; int staI = 0; int staJ = 0; int endI = n-1; int endJ = n-1; while (staI <= endI && staJ <= endJ){ // 环形交换 for (int j = staJ; j < endJ; j++) { int juli = j - staJ; int p1 = arr[staI][j]; int p2 = arr[staI + juli][endJ]; int p3 = arr[endI][endJ - juli]; int p4 = arr[endI - juli][staI]; // System.out.println(p1 + " " + p2 + " " + p3 + " " + p4); arr[staI + juli][endJ] = p1; arr[endI][endJ - juli] = p2; arr[endI - juli][staI] = p3; arr[staI][j] = p4; } staI++; staJ++; endI--; endJ--; } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j == 0){ System.out.print(arr[i][j]); }else { System.out.print(" " + arr[i][j]); } } System.out.println(); } // System.out.println(); } } /* 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4 3 1 2 3 5 6 7 9 10 11 2 1 2 5 6 */