#include <bits/stdc++.h>
using namespace std;
const int N = 8e2 + 1;
int n, m, k, a[N][N];
vector<int> v;
struct P{
int x, y, sum;
};
struct cmp{
bool operator ()(const P &i, const P &j) const{
return i.sum > j.sum;
}
};
int main(){
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m >> k;
v.push_back(0);
for(int i = 1; i <= n; ++i){
priority_queue<P, vector<P>, cmp> tmp;
vector<int> res;
for(int j = 1; j <= m; ++j){
cin >> a[i][j];
tmp.push({j, 0, a[i][j] + v[0]});
}
sort(a[i], a[i] + m + 1);
for(int i = 1; i <= k; ++i){
int x = tmp.top().x, y = tmp.top().y + 1;
res.push_back(tmp.top().sum);
tmp.pop();
if(y < v.size()){
tmp.push({x, y, a[i][x] + v[y]});
}
}
v = res;
sort(v.begin(), v.end());
}
for(int i : v){
cout << i << ' ';
}
return 0;
}