#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, m, k, A[MAXN][5], ans[5];
struct MaxQueue {
  deque<int> q;
  void push(int v) {
    while (((int)q.size()) && q.back() < v) q.pop_back();
    q.push_back(v);
  }
  void pop(int v) {
    if (((int)q.size()) && q.front() == v) q.pop_front();
  }
  int getMax() { return q.front(); }
};
bool P(int sz) {
  long long cand;
  bool ok = false;
  MaxQueue S[5];
  for (int i = (0); i < (int)(sz); i++) {
    for (int j = (0); j < (int)(m); j++) S[j].push(A[i][j]);
  }
  cand = 0;
  for (int j = (0); j < (int)(m); j++) cand += S[j].getMax();
  if (cand <= k) {
    for (int j = (0); j < (int)(m); j++) ans[j] = S[j].getMax();
    ok = true;
  }
  for (int i = (sz); i < (int)(n); i++) {
    for (int j = (0); j < (int)(m); j++) S[j].push(A[i][j]);
    for (int j = (0); j < (int)(m); j++) S[j].pop(A[i - sz][j]);
    cand = 0;
    for (int j = (0); j < (int)(m); j++) cand += S[j].getMax();
    if (cand <= k) {
      for (int j = (0); j < (int)(m); j++) ans[j] = S[j].getMax();
      ok = true;
    }
  }
  return ok;
}
int main() {
  while (scanf("%d%d%d", &n, &m, &k) >= 1) {
    for (int i = (0); i < (int)(n); i++) {
      for (int j = (0); j < (int)(m); j++) {
        scanf("%d", &A[i][j]);
      }
    }
    int a = 0;
    int b = n + 1;
    while (b - a > 1) {
      int c = (a + b) / 2;
      if (P(c)) {
        a = c;
      } else {
        b = c;
      }
    }
    if (a) {
      P(a);
    } else {
      memset(ans, 0, sizeof(ans));
    }
    for (int i = (0); i < (int)(m); i++) {
      if (i) printf(" ");
      printf("%d", ans[i]);
    }
    puts("");
  }
  return 0;
}
