#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

int arr[11][11];
int res[50];

bool compare(int o1, int o2) {
    return o1 > o2;
}

int main() {
    int m;
    while (scanf("%d", &m) != EOF) { // 注意 while 处理多个 case
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < m; j++) {
                scanf("%d", &arr[i][j]);
            }
        }
        int index = 0; //存放数组的下标

        for (int i = 0; i < m; i++) { //每行之和
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += arr[i][j];
            }
            res[index++] = sum;
        }

        for (int i = 0; i < m; i++) { //每列之和
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += arr[j][i];
            }
            res[index++] = sum;
        }

        int sum = 0;
        for (int i = 0; i < m; i++) { //主对角线之和
            sum += arr[i][i];

        }
        res[index++] = sum;

        sum = 0;
        for (int i = 0; i < m; i++) { //副对角线之和
            sum += arr[i][m - 1 - i];

        }
        res[index++] = sum;

        sort(res, res + index, compare);

        for (int i = 0; i < index; i++) {
            printf("%d ", res[i]);
        }

        printf("\n");

    }
}
// 64 位输出请用 printf("%lld")