#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 1e5 + 5;
const long long int inf = 0;
void Hariiih() {
  long long int n, m, k;
  cin >> n >> m >> k;
  vector<vector<long long int> > arr(n, vector<long long int>(m));
  for (long long int i = 0; i < n; ++i) {
    for (long long int j = 0; j < m; ++j) {
      cin >> arr[i][j];
    }
  }
  vector<long long int> maxs(m, 0);
  auto check = [&](long long int len) {
    long long int lef = 0;
    maxs.assign(m, inf);
    deque<long long int> dqs[m];
    long long int localans = 0;
    for (long long int j = 0; j < m; j++) {
      for (long long int i = 0; i < len; i++) {
        localans -= maxs[j];
        maxs[j] = max(maxs[j], arr[i][j]);
        localans += maxs[j];
        while (!(dqs[j].empty()) && dqs[j].back() < arr[i][j]) {
          dqs[j].pop_back();
        }
        dqs[j].push_back(arr[i][j]);
      }
    }
    if (localans <= k) return true;
    for (long long int r = len; r < n; r++) {
      localans = 0;
      for (long long int i = 0; i < m; i++) {
        while (!dqs[i].empty() && dqs[i].back() < arr[r][i]) {
          dqs[i].pop_back();
        }
        dqs[i].push_back(arr[r][i]);
        if (arr[lef][i] == dqs[i].front()) dqs[i].pop_front();
        maxs[i] = dqs[i].front();
        localans += maxs[i];
      }
      if (localans <= k) {
        return true;
      }
      lef++;
    }
    return false;
  };
  long long int l = 1, h = n, ans = 0;
  vector<long long int> ans2;
  while (l <= h) {
    long long int len = l + (h - l) / 2;
    if (check(len)) {
      ans = max(ans, len);
      ans2 = maxs;
      l = len + 1;
    } else
      h = len - 1;
  }
  if (ans == 0) {
    for (long long int i = 0; i < m; ++i) {
      cout << 0 << " ";
    }
  } else {
    for (long long int i = 0; i < m; i++) cout << ans2[i] << " ";
  }
  return;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) Hariiih();
  return 0;
}
