#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, m, k;
int arr[MAXN][7];
int rjesenje[7];
int sol = 0;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &arr[i][j]);
  deque<pair<int, int> > D[5];
  int left = 0, right = 0;
  while (right < n) {
    for (int i = 0; i < m; i++) {
      while (!D[i].empty() && arr[right][i] > D[i].back().first)
        D[i].pop_back();
      D[i].push_back(pair<int, int>(arr[right][i], right));
    }
    for (int i = 0; i < m; i++) {
      while (!D[i].empty() && D[i].front().second < left) D[i].pop_front();
    }
    int len = right - left + 1;
    int sum = 0;
    for (int i = 0; i < m; i++) sum += D[i].front().first;
    if (len > sol && sum <= k) {
      sol = len;
      for (int i = 0; i < m; i++) rjesenje[i] = D[i].front().first;
    }
    if (sum <= k)
      right++;
    else
      left++;
    if (left > right) right++;
  }
  for (int i = 0; i < m; i++) printf("%d ", rjesenje[i]);
  return 0;
}
