#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[5][N], ans[5];
int n, m, k;
bool check(int mid) {
  deque<int> q[5];
  for (int i = (int)(1); i <= (int)(n + 1); i++) {
    if (i > mid) {
      int sum = 0;
      for (int j = 0; j < (int)(m); j++) {
        sum += a[j][q[j].front()];
        ans[j] = a[j][q[j].front()];
      }
      if (sum <= k) return 1;
    }
    if (i <= n) {
      for (int j = 0; j < (int)(m); j++) {
        while (q[j].size() && q[j].front() + mid - 1 < i) {
          q[j].pop_front();
        }
      }
      for (int j = 0; j < (int)(m); j++) {
        while (q[j].size() && a[j][q[j].back()] <= a[j][i]) {
          q[j].pop_back();
        }
        q[j].push_back(i);
      }
    }
  }
  return 0;
}
int main() {
  ios ::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = (int)(1); i <= (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      cin >> a[j][i];
    }
  }
  int l = 0, r = n + 1;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  if (l == 0) {
    for (int i = 0; i < (int)(m); i++) ans[i] = 0;
  } else {
    check(l);
  }
  for (int i = 0; i < (int)(m); i++) cout << ans[i] << " \n"[i == m - 1];
  return 0;
}
