//#pragma GCC optimize("O3, unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define fr(n) for(ll i = 0; i < n; i++)
#define rep(i,a,b) for(int i = a; i < b; i++)
#define vll vector<pair<ll,ll>>
#define vii vector<pair<int,int>>
#define pi acos(-1)
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define print(a) for(auto x:(a))cout << x <<
#define ios ios::sync_with_stdio(0);cin.tie(0);
#define endl "\n"
#define INF (ll)1e15
#define int ll
using namespace std;
void solve(){
int n, m, k; cin >> n >> m >> k;
vector<vector<int>> vec(m, vector<int>(n));
rep(i,0,n){
rep(j,0,m){
cin >> vec[j][i];
}
}
vector<multiset<int>> msets(m);
int mx = -1;
int l=0, r=-1;
pair<int,vector<int>> ans;
while(r < n){
int cur=0;
vector<int> aux;
for(int i = 0;i<m;++i){
int temp=msets[i].size() ? *msets[i].rbegin() : 0;
cur += temp;
aux.push_back(temp);
}
if(cur <= k){
ans = max(ans,make_pair(r-l+1,aux));
r++;
for(int i = 0;i<m;++i) msets[i].insert(vec[i][r]);
}else{
for(int i = 0;i<m;++i) msets[i].erase(msets[i].find(vec[i][l]));
l++;
}
}
for(auto &x:ans.second)
cout << x << " ";
}
int32_t main() {
ios
int t = 1;
while (t--){
solve();
}
return 0;
}
Ly8jcHJhZ21hIEdDQyBvcHRpbWl6ZSgiTzMsIHVucm9sbC1sb29wcyIpCgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxvbmcgbG9uZyAKI2RlZmluZSBmcihuKSBmb3IobGwgaSA9IDA7IGkgPCBuOyBpKyspCiNkZWZpbmUgcmVwKGksYSxiKSBmb3IoaW50IGkgPSBhOyBpIDwgYjsgaSsrKQojZGVmaW5lIHZsbCB2ZWN0b3I8cGFpcjxsbCxsbD4+CiNkZWZpbmUgdmlpIHZlY3RvcjxwYWlyPGludCxpbnQ+PgojZGV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AgIHIrKzsKICAgICAgICAgICAgZm9yKGludCBpID0gMDtpPG07KytpKSBtc2V0c1tpXS5pbnNlcnQodmVjW2ldW3JdKTsKICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgZm9yKGludCBpID0gMDtpPG07KytpKSBtc2V0c1tpXS5lcmFzZShtc2V0c1tpXS5maW5kKHZlY1tpXVtsXSkpOwogICAgICAgICAgICBsKys7CiAgICAgICAgfQogICAgfQogICAgZm9yKGF1dG8gJng6YW5zLnNlY29uZCkKICAgICAgICBjb3V0IDw8IHggPDwgIiAiOwogICAgCn0KCmludDMyX3QgbWFpbigpIHsKICAgIGlvcwogICAgaW50IHQgPSAxOwogICAgd2hpbGUgKHQtLSl7CiAgICAgICAgc29sdmUoKTsKICAgIH0KCiAgICByZXR1cm4gMDsKfQ==