#include <fstream>

using namespace std;

int main()
{
	ifstream input;
	ofstream output;

	input.open("MATRANVUONG.inp");
	output.open("MATRANVUONG.out");

	long long n;
	long long a;
	long long tong1 = 0, tong2 = 0, tong3 = 0, tong4 = 0, tong5 = 0, tong6 = 0;
	input >> n;

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			input >> a;
			if (i == j) tong1 += a;
			if (i + j == n - 1) tong2 += a;
			if (j == i + 1 || i == j + 1) tong3 += a;
			if (i + j == n - 2 || i + j == n) tong4 += a;
			if (i < j) tong5 += a;
			if (i + j >= n) tong6 += a;
		}
	}
	output << tong1 << '\n' << tong2 << '\n' << tong3 << '\n' << tong4 << '\n' << tong5 << '\n' << tong6;
	input.close();
	output.close();
	return 0;
}