#include<iostream>
#include<fstream>
using namespace std;
int main ()
{
	int t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,n,b,c,a[1001][1001];
	ifstream f1; f1.open("MATRANVUONG.INP");
	f1>>n;
	for(b=1;b<n;b++)
	 for(c=1;c<n;c++)
		{
	  	f1>>a[b][c];
	  	if(b==c) t1=t1+a[b][c];
	  	if(b+c==n+1) t2=t2+a[b][c];
	  	if(b-c==1) || (c-b==1) t3=t3+a[b][c];
	  	if(b+c==n) || (b+c==n+2) t4=t4+a[b][c];
	  	if(b<c) t5=t5+a[b][c];
	  	if(b>c) t6=t6+a[b][c];
		}
	f1.close();
	ofstream f2;f2.open("MATRANVUONG.OUT");
	f2<<t1<<endl<<t2<<endl<<t3<<endl<<t4<<endl<<t5<<endl<<t6;
	f2.close();
	
	
}
