#include <bits/stdc++.h>
using namespace std;
long long dx[8] = {-1, -1, -1, 0, 1, 0, 1, 1};
long long dy[8] = {-1, 0, 1, -1, -1, 1, 1, 0};
long long tc, n, k, m, a[100001][5], ans;
string s;
map<int, multiset<int>> mp;
vector<long long> res(5, 0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  int l = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; j++) {
      mp[j].insert(a[i][j]);
    }
    long long cur = 0;
    for (int p = 0; p < m; p++) {
      cur += *--mp[p].end();
    }
    while (cur > k && l <= i) {
      for (int p = 0; p < m; p++) {
        auto it = mp[p].find(a[l][p]);
        mp[p].erase(it);
      }
      cur = 0;
      for (int p = 0; p < m && i != l; p++) {
        cur += *--mp[p].end();
      }
      l++;
    }
    if (cur <= k && ans < (i - l + 1ll) && l <= i) {
      for (int p = 0; p < m; p++) {
        res[p] = *--mp[p].end();
      }
      ans = i - l + 1ll;
    }
  }
  for (int i = 0; i < m; ++i) {
    cout << res[i] << " ";
  }
}
