#include <bits/stdc++.h>
using namespace std;
int n;
int m;
long k;
vector<vector<long>> details;
int main() {
  cin >> n >> m >> k;
  int i;
  int j;
  for (i = 0; i < n; ++i) {
    vector<long> d;
    long t;
    for (j = 0; j < m; ++j) {
      cin >> t;
      d.push_back(t);
    }
    details.push_back(d);
  }
  int t;
  vector<long> current;
  vector<long> oCurrent;
  int oCount = 0;
  int start = 0;
  int end = -1;
  long sum = 0;
  vector<map<long, int>> trackingDetails;
  for (t = 0; t < m; ++t) {
    map<long, int> newMap;
    trackingDetails.push_back(newMap);
    current.push_back(0);
    oCurrent.push_back(0);
  }
  while (end < n - 1) {
    vector<long> entry = details[end + 1];
    vector<long> newCurrent = current;
    long newSum = sum;
    for (t = 0; t < m; ++t) {
      long diff = entry[t] - current[t];
      if (diff > 0) {
        newSum += diff;
        newCurrent[t] += diff;
      }
    }
    if (newSum <= k) {
      sum = newSum;
      current = newCurrent;
      end++;
      for (t = 0; t < m; ++t) {
        trackingDetails[t][entry[t]]++;
      }
      if (end - start + 1 > oCount) {
        oCount = end - start + 1;
        oCurrent = current;
      }
    } else if (start >= end) {
      if (start > end) {
        end++;
      }
      start++;
      sum = 0;
      for (t = 0; t < m; ++t) {
        current[t] = 0;
      }
    } else {
      for (t = 0; t < m; ++t) {
        trackingDetails[t][details[start][t]]--;
        if (trackingDetails[t][details[start][t]] == 0) {
          if (details[start][t] == current[t]) {
            map<long, int>::iterator it =
                trackingDetails[t].lower_bound(details[start][t]);
            --it;
            sum -= current[t] - it->first;
            current[t] = it->first;
          }
          trackingDetails[t].erase(details[start][t]);
        }
      }
      start++;
    }
  }
  for (i = 0; i < m; ++i) {
    cout << oCurrent[i] << " ";
  }
}
