#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7, N = 1e5 + 10, LG = 17;
int n, m, k;
int a[N][5], pre[N][LG][5], lg[N];
void compute() {
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      pre[j][0][i] = a[j][i];
    }
  }
  for (int kk = 0; kk < m; kk++) {
    for (int j = 1; j < LG; j++) {
      for (int i = 0; i + (1 << j) <= n; i++) {
        pre[i][j][kk] =
            max(pre[i][j - 1][kk], pre[i + (1 << (j - 1))][j - 1][kk]);
      }
    }
  }
  lg[1] = 0;
  for (int i = 2; i < n + 1; i++) {
    lg[i] = lg[i / 2] + 1;
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  compute();
  int l = 0, r = 0, ans = 0, start = -1, end = -1;
  while (l < n and r < n) {
    int j = lg[r - l + 1];
    ll sum = 0;
    for (int i = 0; i < m; i++) {
      sum += max(pre[l][j][i], pre[r - (1 << j) + 1][j][i]);
    }
    if (sum <= k) {
      if (r - l + 1 > ans) {
        ans = r - l + 1;
        start = l;
        end = r;
      }
      r++;
    } else {
      l++;
    }
    if (l > r) {
      r = l;
    }
  }
  int j = lg[end - start + 1];
  for (int i = 0; i < m; i++) {
    cout << max(pre[start][j][i], pre[end - (1 << j) + 1][j][i]) << " ";
  }
  return 0;
}
