#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int w[N], h[N], ne[N << 1], e[N << 1], idx;
int n, m, k;
int a[N][6];
int pre[N];
struct node {
  int l, r;
  int mx;
};
struct X {
  node tr[N << 2];
  void pushup(int u) { tr[u].mx = max(tr[u << 1].mx, tr[u << 1 | 1].mx); }
  void build(int u, int l, int r) {
    if (l == r) {
      tr[u] = {l, r, 0};
      return;
    } else {
      tr[u] = {l, r, 0};
      int mid = l + r >> 1;
      build(u << 1, l, mid);
      build(u << 1 | 1, mid + 1, r);
    }
  }
  void modify(int u, int l, int x) {
    if (tr[u].l == tr[u].r) {
      tr[u].mx = x;
      return;
    }
    int mid = tr[u].l + tr[u].r >> 1;
    if (l <= mid)
      modify(u << 1, l, x);
    else
      modify(u << 1 | 1, l, x);
    pushup(u);
  }
  int query(int u, int l, int r) {
    if (tr[u].l >= l && tr[u].r <= r) {
      return tr[u].mx;
    }
    int mid = tr[u].l + tr[u].r >> 1;
    int ans = 0;
    if (l <= mid) {
      ans = query(u << 1, l, r);
    }
    if (r > mid) ans = max(ans, query(u << 1 | 1, l, r));
    return ans;
  }
} st[6];
bool check(int x) {
  int i;
  for (i = 1; i + x - 1 <= n; i++) {
    int ans = 0;
    int ok = 0;
    for (int j = 1; j <= m; j++) {
      int tmp = st[j].query(1, i, i + x - 1);
      ans += tmp;
      pre[j] = tmp;
      if (ans > k) {
        ok = 1;
        break;
      }
    }
    if (!ok) {
      return true;
    }
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  int i;
  for (i = 1; i <= m; i++) {
    st[i].build(1, 1, n);
  }
  for (i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      st[j].modify(1, i, a[i][j]);
    }
  }
  int l = 0, r = n;
  while (l < r) {
    int mid = l + r + 1 >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  check(l);
  for (i = 1; i <= m; i++) {
    cout << pre[i] << " ";
  }
  cout << endl;
}
