#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[5][maxn];
deque<pair<int, int> > Q[5];
vector<int> sol;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[j][i]);
    }
  }
  int l = 1, r = n, ans = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    bool succ = 0;
    for (int i = 0; i < m; i++) Q[i].clear();
    for (int i = 0; i < mid - 1; i++) {
      for (int j = 0; j < m; j++) {
        if (Q[j].empty()) {
          Q[j].push_back(make_pair(a[j][i], i));
        } else {
          while (!Q[j].empty() && Q[j].back().first <= a[j][i]) Q[j].pop_back();
          Q[j].push_back(make_pair(a[j][i], i));
        }
      }
    }
    for (int i = mid - 1; i < n && !succ; i++) {
      for (int j = 0; j < m; j++) {
        if (Q[j].empty()) {
          Q[j].push_back(make_pair(a[j][i], i));
        } else {
          while (!Q[j].empty() && Q[j].back().first <= a[j][i]) Q[j].pop_back();
          Q[j].push_back(make_pair(a[j][i], i));
        }
        while (!Q[j].empty() && i - Q[j].front().second >= mid)
          Q[j].pop_front();
      }
      int tmp = 0;
      for (int j = 0; j < m; j++) tmp += Q[j].front().first;
      if (tmp <= k) {
        succ = 1;
      }
    }
    if (succ) {
      ans = mid;
      l = mid + 1;
      sol.clear();
      for (int j = 0; j < m; j++) sol.push_back(Q[j].front().first);
    } else {
      r = mid - 1;
    }
  }
  if (ans == 0) {
    for (int i = 0; i < m; i++) printf("0%c", i == m - 1 ? '\n' : ' ');
  } else {
    for (int i = 0; i < m; i++) printf("%d%c", sol[i], i == m - 1 ? '\n' : ' ');
  }
  return 0;
}
