#include <bits/stdc++.h>
using namespace std;
namespace fastIO {
bool IOerror = 0;
inline char nc() {
  static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 100000, stdin);
    if (pend == p1) {
      IOerror = 1;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void read(long long &x) {
  char ch;
  while (blank(ch = nc()))
    ;
  if (IOerror) return;
  for (x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0')
    ;
}
inline void read(int &x) {
  char ch;
  while (blank(ch = nc()))
    ;
  if (IOerror) return;
  for (x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0')
    ;
}
};  // namespace fastIO
using namespace fastIO;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct segtree {
  int l, r, mx[5];
} t[4 * 100010];
int n, m, k, ans = -0x7ffffff;
int a[100100][5];
int ansd[5];
inline void update(int now) {
  for (int i = 0; i < m; i++)
    t[now].mx[i] = max(t[now << 1].mx[i], t[now << 1 | 1].mx[i]);
}
inline void buildtree(int now, int l, int r) {
  t[now].l = l;
  t[now].r = r;
  if (l == r) {
    for (int i = 0; i < m; i++) t[now].mx[i] = a[l][i];
    return;
  }
  int mid = (l + r) >> 1;
  buildtree(now << 1, l, mid);
  buildtree(now << 1 | 1, mid + 1, r);
  update(now);
}
inline int ask(int now, int x, int y, int d) {
  if (y < x) return 0;
  int l = t[now].l, r = t[now].r;
  if (l == x && r == y) return t[now].mx[d];
  int mid = (l + r) >> 1;
  if (y <= mid)
    return ask(now << 1, x, y, d);
  else if (x > mid)
    return ask(now << 1 | 1, x, y, d);
  else
    return max(ask(now << 1, x, mid, d), ask(now << 1 | 1, mid + 1, y, d));
}
inline bool jud(int l, int r, int t) {
  int sum = 0;
  for (int i = 0; i < m; i++) sum += ask(1, l, r, i);
  return sum <= t;
}
int main() {
  n = read();
  m = read();
  k = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < m; j++) a[i][j] = read();
  }
  buildtree(1, 1, n);
  for (int i = 1; i <= n; i++) {
    int l = i, r = n, s = i - 1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (jud(i, mid, k))
        s = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    if (s - i >= ans) {
      ans = s - i;
      for (int j = 0; j < m; j++) ansd[j] = ask(1, i, s, j);
    }
  }
  for (int i = 0; i < m; i++) printf("%d ", ansd[i]);
  puts("");
}
