#include <iostream>
using namespace std;
const int MAX_SIZE = 100;
const int MAX_COLUMNS = 20;
const int FOUR_LINES = 4;
const int ONE = 1, TWO = 2, THREE = 3, FOUR = 4;
int main() {
int n, mtx[MAX_SIZE + 1][MAX_SIZE + 1];
cin >> n;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
cin >> mtx[i][j];
}
}
int m[FOUR_LINES + 1][MAX_COLUMNS];
int columnForOne = 1, columnForTwo = 1, columnForThree = 1, columnForFour = 1;
for (int line = 1; line <= n; ++line) {
for (int column = 1; column <= n; ++column) {
if ((line != column) && (line + column != n + 1) && (line < column) && (line + column <= n)) {
m[ONE][columnForOne] = mtx[line][column];
++columnForOne;
}
else if ((line != column) && (line + column != n + 1) && (line > column) && (line + column <= n)) {
m[TWO][columnForTwo] = mtx[line][column];
++columnForTwo;
}
else if ((line != column) && (line + column != n + 1) && (line > column) && (line + column > n + 1)) {
m[THREE][columnForThree] = mtx[line][column];
++columnForThree;
}
else if ((line != column) && (line + column != n + 1) && (line < column) && (line + column > n + 1)) {
m[FOUR][columnForFour] = mtx[line][column];
++columnForFour;
}
}
}
int columnRank;
if (n % 2 == 0){
columnRank = (n * n - (n + n)) / 4;
} else {
columnRank = (n * n - (n + n - 1)) / 4;
}
for (int i = 1; i <= FOUR; ++i) {
for (int j = 1; j <= columnRank; ++j) {
cout << m[i][j] << " ";
}
cout << "\n";
}
return 0;
}