#include <iostream>
#include <vector>
using namespace std;
int main()
{
short t, n;
while (t--)
{
cin >> n;
int arr[n][n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> arr[i][j];
}
}
for (int k = 1 - n; k < n; k++)
{
vector <int> x;
short l = 0;
int sum = 0;
for (int i = 0; i < n; i++)
{
while(i+k<n)
{
x[l]=arr[i][i + k];
l++;
}
}
for (int z = 1; z < l; z++)
{
if (x[0] > x[z])
{
x[0] = x[z];
}
}
if (x[0] < 0)
{
sum += -x[0];
}
cout << sum << endl;
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKQp7CglzaG9ydCB0LCBuOwoKCXdoaWxlICh0LS0pCgl7CgkJY2luID4+IG47CgoJCWludCBhcnJbbl1bbl07CgoJCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQoJCXsKCQkJZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspCgkJCXsKCQkJCWNpbiA+PiBhcnJbaV1bal07CgkJCX0KCQl9CgoKCQlmb3IgKGludCBrID0gMSAtIG47IGsgPCBuOyBrKyspCgkJewoJCQl2ZWN0b3IgPGludD4geDsKCQkJc2hvcnQgbCA9IDA7CgkJCWludCBzdW0gPSAwOwoJCQlmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykKCQkJewoJCQkJd2hpbGUoaStrPG4pCgkJCQl7CgkJCQkJeFtsXT1hcnJbaV1baSArIGtdOwoJCQkJCWwrKzsKCQkJCX0KCQkJCQoJCQl9CgkJCWZvciAoaW50IHogPSAxOyB6IDwgbDsgeisrKQoJCQl7CgkJCQlpZiAoeFswXSA+IHhbel0pCgkJCQl7CgkJCQkJeFswXSA9IHhbel07CgkJCQl9CgkJCX0KCQkJaWYgKHhbMF0gPCAwKQoJCQl7CgkJCQlzdW0gKz0gLXhbMF07CgkJCX0KCQkJY291dCA8PCBzdW0gPDwgZW5kbDsKCQkKCQl9CgoJfQp9