#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
vector<long long> robots[5];
vector<long long> calcular(int t) {
  deque<long long> DQ[m];
  vector<long long> ans(m + 1, 0);
  if (t == 0) return ans;
  for (int step = (0); step < (m); step++) {
    for (int i = (0); i < (t); i++) {
      while (!DQ[step].empty() and
             robots[step][DQ[step].back()] < robots[step][i])
        DQ[step].pop_back();
      DQ[step].push_back(i);
    }
    ans[step] = robots[step][DQ[step].front()];
    ans[m] += ans[step];
  }
  vector<long long> final_ans = ans;
  for (int i = (t); i < (n); i++) {
    ans[m] = 0;
    for (int step = (0); step < (m); step++) {
      int j = i - t;
      if (!DQ[step].empty() and DQ[step].front() == j) DQ[step].pop_front();
      while (!DQ[step].empty() and
             robots[step][DQ[step].back()] < robots[step][i])
        DQ[step].pop_back();
      DQ[step].push_back(i);
      ans[step] = robots[step][DQ[step].front()];
      ans[m] += ans[step];
    }
    if (ans[m] < final_ans[m]) final_ans = ans;
  }
  return final_ans;
}
vector<long long> solve() {
  int lo = 0, hi = n, mi;
  vector<long long> ans = calcular(hi);
  if (ans.back() <= k) {
    ans.pop_back();
    return ans;
  }
  while (hi - lo > 1) {
    mi = (hi + lo) / 2;
    ans = calcular(mi);
    if (ans.back() <= k)
      lo = mi;
    else
      hi = mi;
  }
  ans = calcular(lo);
  ans.pop_back();
  return ans;
}
int main() {
  cin >> n >> m >> k;
  for (int i = (0); i < (m); i++) robots[i].resize(n);
  for (int i = (0); i < (n); i++) {
    for (int j = (0); j < (m); j++) cin >> robots[j][i];
  }
  vector<long long> ans = solve();
  for (int i = (0); i < (ans.size()); i++) {
    if (i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
