#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[5][100005], que[5][100005], lt[5], rt[5], ans[5];
bool ck(int u) {
  if (u == 0) return 1;
  if (u == n + 1) return 0;
  for (int i = 0; i < m; ++i) rt[i] = 0, lt[i] = 1;
  for (int i = 1; i <= u - 1; ++i)
    for (int j = 0; j < m; ++j) {
      while (lt[j] <= rt[j] && a[j][que[j][rt[j]]] <= a[j][i]) --rt[j];
      que[j][++rt[j]] = i;
    }
  for (int i = u; i <= n; ++i) {
    long long sum = 0;
    for (int j = 0; j < m; ++j) {
      while (lt[j] <= rt[j] && que[j][lt[j]] < i - u + 1) ++lt[j];
      while (lt[j] <= rt[j] && a[j][que[j][rt[j]]] <= a[j][i]) --rt[j];
      que[j][++rt[j]] = i;
      sum += a[j][que[j][lt[j]]];
    }
    if (sum <= k) {
      for (int j = 0; j < m; ++j) ans[j] = a[j][que[j][lt[j]]];
      return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &a[j][i]);
  int l = 0, r = n + 1, mid;
  while (l < r - 1) {
    mid = (l + r) / 2;
    if (ck(mid))
      l = mid;
    else
      r = mid;
  }
  for (int i = 0; i < m; ++i) printf("%d ", ans[i]);
}
