#include <stdio.h> //注意还有主副对角线的和,测试用例是多组输入 int main() { int m = 0; while(scanf("%d", &m)!=EOF){ int arr[10][10] = { 0 }; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) scanf("%d", &arr[i][j]); } int num[25] = { 0 }; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { num[i] += arr[i][j]; } } int k = m; for (int j = 0; j < m; j++) { for (int i = 0; i < m; i++) { num[k] += arr[i][j]; } k++; } for (int i = 0; i < m; i++) num[2 * m] += arr[i][i]; for (int i = 0; i < m; i++) num[2 * m + 1] += arr[i][m - i - 1]; for (int i = 0; i < 2 * m + 2; i++) { for (int j = 0; j < 2 * m - i + 1; j++) { if (num[j] < num[j + 1]) { int temp = num[j]; num[j] = num[j + 1]; num[j + 1] = temp; } } } for (int i = 0; i < 2 * m + 2; i++) printf("%d ", num[i]); printf("\n"); } return 0; }