#include <bits/stdc++.h>
int n,a[1000][1000],tong2 = 0,tong1 = 0,t3 = 0,t4 = 0,t5 = 0,t6 = 0;
using namespace std;
int main()
{
    ifstream f1("matranvuong.inp");
    ofstream f2("matranvuong.out");
    f1>>n;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            f1>>a[i][j];
        }
    }
    for (int i = 0; i < n; i++)
    {
        tong1 += a[i][i];
        tong2 += a[i][n-i-1];
        t3 += a[i][i+1] + a[i+1][i];
        t4 += a[i][n-i-2] + a[i][n-i];
        for (int j = i+1; j < n; j++)
        {
            t5 += a[i][j];
            t6 += a[j][n-i-1];
        }
    }
    f2<<tong1<<endl;
    f2<<tong2<<endl;
    f2<<t3<<endl;
    f2<<t4<<endl;
    f2<<t5<<endl;
    f2<<t6<<endl;
    return 0;
}
