#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  map<int, int> mm[m];
  int arr[m][n];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> arr[j][i];
    }
  }
  int mx = 0, fl = -1, fr = -1;
  priority_queue<int> pq[m];
  int l = 0;
  long long cost, tempcost;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      mm[j][arr[j][i]] = i;
      pq[j].push(arr[j][i]);
    }
    long long cost = 0;
    for (int j = 0; j < m; ++j) {
      while (mm[j][pq[j].top()] < l) pq[j].pop();
      cost += pq[j].top();
    }
    while (l < i && cost > k) {
      tempcost = 0;
      for (int j = 0; j < m; ++j) {
        while (mm[j][pq[j].top()] < (l + 1)) pq[j].pop();
        tempcost += pq[j].top();
      }
      cost = tempcost;
      l++;
    }
    if (cost <= k) {
      if (i - l + 1 > mx) {
        mx = (i - l + 1);
        fl = l;
        fr = i;
      }
    }
  }
  if (mx == 0) {
    for (int i = 0; i < m; ++i) {
      cout << 0 << " ";
    }
    return;
  }
  for (int i = 0; i < m; ++i) {
    mx = 0;
    for (int j = fl; j < fr + 1; ++j) {
      mx = max(mx, arr[i][j]);
    }
    cout << mx << " ";
  }
  return;
}
int main() {
  boost();
  int tc = 1;
  while (tc--) solve();
  return 0;
}
