#include <iostream>
#include <fstream>
using namespace std;
int main() {
	ifstream f1("MATRANVUONG.INP");
    ofstream f2("MATRANVUONG.OUT");

	int n,i,j;
	f1>>n;
	long int a[n+1][n+1];
	 int tong1=0,tong2=0,tong3=0,tong4=0,tong5=0,tong6=0;

	for (i=1;i<=n;i++)
	{for (j=1;j<=n;j++)
	f1>>a[i][j];
	}
	f1.close();
	for (i=1;i<=n;i++)
	{for (j=1;j<=n;j++)
	{if (j==i)
	 {tong1=tong1+a[i][j];}
	if (j==n+1-i)
	 {tong2=tong2+a[i][j];}
	 if (j==i+1||j==i-1 )
	 {tong3=tong3+a[i][j];}
	 if (j==n-i||j==n+2-i)
	 {tong4=tong4+a[i][j];}
	 if (j>i)
	 {tong5=tong5+a[i][j];}
	 if (j>n+1-i)
	 {tong6=tong6+a[i][j];}}}
	f2<<tong1<<endl<<tong2<<endl<<tong3<<endl<<tong4<<endl<<tong5<<endl<<tong6;
		return 0;
}
