#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2, M = 5 + 2, LOG = 20 + 2;
int n, m, k, a[N][M], rmq[N][M][LOG], lg[N];
int get_max(int st, int en, int t) {
  return st >= en ? (st == en) * a[st][t]
                  : max(rmq[st][t][lg[en - st]],
                        rmq[en - (1 << lg[en - st])][t][lg[en - st]]);
}
int cost(int st, int en) {
  int sum = 0;
  for (int i = 0; i < M; i++) sum += get_max(st, en, i);
  return sum;
}
void readInput() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
}
void prep() {
  for (int i = 2; i < n; i++) lg[i] = lg[i / 2] + 1;
  for (int i = n - 1; ~i; i--)
    for (int j = 0; j < m; j++) {
      rmq[i][j][0] = max(a[i][j], a[i + 1][j]);
      for (int k = 1; k <= lg[n - i - 1]; k++)
        rmq[i][j][k] = max(rmq[i][j][k - 1], rmq[i + (1 << (k - 1))][j][k - 1]);
    }
}
void solve() {
  int st = 0, en = 0;
  for (int p1 = 0, p2 = 0; p2 < n; p1++, p2++) {
    while (p2 < n && cost(p1, p2) <= k) p2++;
    if (p2 - p1 > en - st) st = p1, en = p2;
  }
  for (int i = 0; i < m; i++) cout << get_max(st, en - 1, i) << ' ';
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  readInput(), prep(), solve();
  return 0;
}
