#include <bits/stdc++.h>
using namespace std;
const int Z = (int)3e3 + 228;
const int N = (int)1e6 + 228;
const int INF = (int)1e9 + 228;
const int MOD = (int)1e9 + 7;
int a[N][5], ans[5], mx[5];
int t[N][5];
void build(int ind, int v, int tl, int tr) {
  if (tl == tr) {
    t[v][ind] = a[tl][ind];
    return;
  }
  int mid = (tl + tr) / 2;
  build(ind, 2 * v, tl, mid);
  build(ind, 2 * v + 1, mid + 1, tr);
  t[v][ind] = max(t[2 * v][ind], t[2 * v + 1][ind]);
}
int get_max(int ind, int v, int tl, int tr, int l, int r) {
  if (tl >= l && tr <= r) return t[v][ind];
  if (tl > r || tr < l) return -INF;
  int mid = (tl + tr) / 2;
  return max(get_max(ind, 2 * v, tl, mid, l, r),
             get_max(ind, 2 * v + 1, mid + 1, tr, l, r));
}
bool can(int mid, int n, int m, int k) {
  for (int l = 1; l <= n; l++) {
    int r = l + mid - 1;
    if (r > n) break;
    for (int ind = 1; ind <= m; ind++) mx[ind] = get_max(ind, 1, 1, n, l, r);
    int res = 0;
    for (int ind = 1; ind <= m; ind++) res += mx[ind];
    if (res <= k) {
      for (int ind = 1; ind <= m; ind++) ans[ind] = mx[ind];
      return true;
    }
  }
  return false;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= m; i++) build(i, 1, 1, n);
  int l = 0, r = n;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (can(mid, n, m, k))
      l = mid;
    else
      r = mid - 1;
  }
  for (int i = 1; i <= m; i++) cout << ans[i] << ' ';
  return 0;
}
