#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5;
const int M = 5;
int a[N][M];
deque<int> q[M];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int m;
  cin >> m;
  int k;
  cin >> k;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  int bestI = 0;
  int bestJ = 0;
  auto ok = [&]() {
    int sum = 0;
    for (int k = 0; k < m; ++k) sum += q[k].empty() ? 0 : a[q[k].front()][k];
    return sum <= k;
  };
  for (int i = 0, j = 0; i < n; ++i) {
    while (j < n && ok()) {
      for (int k = 0; k < m; ++k) {
        while (!q[k].empty() && a[j][k] >= a[q[k].back()][k]) q[k].pop_back();
        q[k].push_back(j);
      }
      ++j;
    }
    int ii = i;
    int jj = ok() ? j : j - 1;
    if (jj - ii > bestJ - bestI) {
      bestI = ii;
      bestJ = jj;
    }
    for (int k = 0; k < m; ++k) {
      if (!q[k].empty() && q[k].front() <= i) q[k].pop_front();
    }
  }
  for (int k = 0; k < m; ++k) {
    int mx = 0;
    for (int x = bestI; x < bestJ; ++x) mx = max(mx, a[x][k]);
    cout << mx << ' ';
  }
  return 0;
}
