#include <bits/stdc++.h>
using namespace std;
int main ()
{
    freopen("MATRANVUONG.inp","r",stdin);
    freopen("MATRANVUONG.out","w",stdout);
    long n; cin>>n;
    vector <vector<long> > a(n + 2, vector<long>(n + 2, 0));
    long b,c,d,e,f,g,h,i,k,l,m,o,x,y,z,p,q,t; p=z=k=m=o=f=0; h=n;
    for (b=1;b<=n;b++)
        for (c=1;c<=n;c++)
        cin>>a[b][c];

    for (e=1;e<=n;e++)
        {f+=a[e][e];
        m+=a[e-1][e]+a[e+1][e];}
    for (g=1;g<=n;g++)
       {
           o+=a[g][h-g+1];
           k+=a[g-1][h-g+1]+a[g+1][h-g+1];}
    for (i=1;i<=n;i++)
        for (x=i+1;x<=n;x++)
        z+=a[i][x];
    for (y=1; y<=n;y++)
        for (t=n-y+2;t<=n;t++)
        p+=a[y][t];
    cout << f <<endl <<o <<endl<<m<<endl<<k<<endl<<z<<endl<<p;



}
