#include <iostream>
using namespace std;
const int MAX_SIZE = 10;
int main() {
int n, m, mt[MAX_SIZE + 1][MAX_SIZE + 1], arr[MAX_SIZE + 1];
//pentru optimizare cu fara mt, in loc de mt[][]-> currentElem;
cin >> n >> m;
int arrIndex = 1;
for(int i = 1; i <= n; ++i) {
int sum = 0;
for(int j = 1; j <= m; ++j) {
cin >> mt[i][j];
sum += mt[i][j];
}
arr[arrIndex++] = sum;//arr[i] = sum;
}
for(int i = 1; i < n ; ++i) {
for(int j = i + 1; j <= n ; ++j) {
if(arr[i] < arr[j]) {
swap(arr[i], arr[j]);
/*int temp;//de creat intre cele 2 for-uri casa se creeze
deodata cu for-ul si sa se stinga cu el pentru a nu tot
aloca si dealoca memoria
if (v[i] < v[j]) {
temp = v[i];
v[i] = v[j];
v[j] = temp;
}*/
}
}
}
for(int i = 1; i <= n; ++i) {
cout << arr[i] << " ";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9TSVpFID0gMTA7CgppbnQgbWFpbigpIHsKCWludCBuLCBtLCBtdFtNQVhfU0laRSArIDFdW01BWF9TSVpFICsgMV0sIGFycltNQVhfU0laRSArIDFdOwoJLy9wZW50cnUgb3B0aW1pemFyZSBjdSBmYXJhIG10LCBpbiBsb2MgZGUgbXRbXVtdLT4gY3VycmVudEVsZW07CgljaW4gPj4gbiA+PiBtOwoJaW50IGFyckluZGV4ID0gMTsKCWZvcihpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CgkJaW50IHN1bSA9IDA7CgkJZm9yKGludCBqID0gMTsgaiA8PSBtOyArK2opIHsKCQkJY2luID4+IG10W2ldW2pdOwoJCQlzdW0gKz0gbXRbaV1bal07CgkJfQoJCWFyclthcnJJbmRleCsrXSA9IHN1bTsvL2FycltpXSA9IHN1bTsKCX0KCWZvcihpbnQgaSA9IDE7IGkgPCBuIDsgKytpKSB7CgkJZm9yKGludCBqID0gaS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