#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long powm(long long a, long long p, long long m) {
  long long r = 1 % m;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
int a[100000][5], tree[400000][5], n, m, k, sum[100000], tans[5];
void build(int root, int l, int r) {
  if (l == r)
    for (int i = 0; i < (m); ++i) tree[root][i] = a[l][i];
  else if (l < r) {
    build(2 * root + 1, l, (l + r) / 2);
    build(2 * root + 2, (l + r) / 2 + 1, r);
    for (int i = 0; i < (m); ++i)
      tree[root][i] = max(tree[2 * root + 1][i], tree[2 * root + 2][i]);
  }
}
void getMax(int root, int l, int r, int ql, int qr) {
  if (qr < l || ql > r) return;
  if (ql <= l && r <= qr)
    for (int i = 0; i < (m); ++i) tans[i] = max(tans[i], tree[root][i]);
  else {
    getMax(2 * root + 1, l, (l + r) / 2, ql, qr);
    getMax(2 * root + 2, (l + r) / 2 + 1, r, ql, qr);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (m); ++j) {
      scanf("%d", a[i] + j);
      sum[i] += a[i][j];
    }
  int tmp = min_element(sum, sum + n) - sum;
  if (sum[tmp] > k) {
    for (int i = 0; i < (m); ++i) printf("0 ");
    puts("");
    return 0;
  }
  build(0, 0, n - 1);
  int ansl = tmp, ansr = tmp, best = 1;
  for (int l = 0; l < (n); ++l) {
    int left = l, right = n, ts = inf;
    while (right - left > 1) {
      int mid = (left + right) >> 1;
      int s = 0;
      memset(tans, 0, sizeof(tans));
      getMax(0, 0, n - 1, l, mid);
      for (int j = 0; j < (m); ++j) s += tans[j];
      if (s <= k) {
        left = mid;
        ts = s;
      } else
        right = mid;
    }
    if (left - l + 1 > best && ts <= k) {
      ansl = l;
      ansr = left;
      best = left - l + 1;
    }
  }
  memset(tans, 0, sizeof(tans));
  getMax(0, 0, n - 1, ansl, ansr);
  for (int i = 0; i < (m); ++i) printf("%d ", tans[i]);
  puts("");
  return 0;
}
