#include <iostream>
#include <vector>
using namespace std;
void rotateSectors(vector<vector<int>>& matrix, int n) {
vector<vector<int>> result(n, vector<int>(n));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (i < n / 2 && j < n / 2) {
// Top-left sector to top-right
result[i][j + n / 2 + n % 2] = matrix[i][j];
} else if (i < n / 2 && j >= n / 2 + n % 2) {
// Top-right sector to bottom-right
result[i + n / 2 + n % 2][j] = matrix[i][j];
} else if (i >= n / 2 + n % 2 && j >= n / 2 + n % 2) {
// Bottom-right sector to bottom-left
result[i][j - n / 2 - n % 2] = matrix[i][j];
} else if (i >= n / 2 + n % 2 && j < n / 2) {
// Bottom-left sector to top-left
result[i - n / 2 - n % 2][j] = matrix[i][j];
}
}
}
// Print the result matrix
for (const auto& row : result) {
for (int elem : row) {
cout << elem << " ";
}
cout << endl;
}
}
int main() {
int n;
cin >> n;
vector<vector<int>> matrix(n, vector<int>(n));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cin >> matrix[i][j];
}
}
rotateSectors(matrix, n);
return 0;
}