#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n, m, k, niza[100001][5], best[5], possible[5];
  memset(best, 0, sizeof best);
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &niza[i][j]);
    }
  }
  int l = 1;
  int r = n;
  while (l <= r) {
    int midpoint = l + (r - l) / 2;
    bool ok = false;
    stack<int> s1[5], s2[5], s1max[5], s2max[5];
    for (int i = 0; i < midpoint - 1; i++) {
      for (int j = 0; j < m; j++) {
        if (i == 0) {
          s1[j].push(niza[i][j]);
          s1max[j].push(niza[i][j]);
        } else {
          s1[j].push(niza[i][j]);
          if (niza[i][j] > s1max[j].top()) s1max[j].push(niza[i][j]);
        }
      }
    }
    for (int i = midpoint - 1; i < n; i++) {
      for (int j = 0; j < m; j++) {
        s1[j].push(niza[i][j]);
        if (s1max[j].empty())
          s1max[j].push(niza[i][j]);
        else {
          if (s1max[j].top() <= niza[i][j]) s1max[j].push(niza[i][j]);
        }
      }
      if (i >= midpoint) {
        for (int j = 0; j < m; j++) {
          if (!s2[j].empty()) {
            if (s2max[j].top() == s2[j].top()) {
              s2max[j].pop();
            }
            s2[j].pop();
          } else {
            while (!s1[j].empty()) {
              s2[j].push(s1[j].top());
              if (s2max[j].empty()) {
                s2max[j].push(s1[j].top());
              } else {
                if (s2max[j].top() <= s1[j].top()) {
                  s2max[j].push(s1[j].top());
                }
              }
              s1[j].pop();
            }
            while (!s1max[j].empty()) s1max[j].pop();
            if (s2max[j].top() == s2[j].top()) s2max[j].pop();
            s2[j].pop();
          }
        }
      }
      int sum = 0;
      for (int j = 0; j < m; j++) {
        int levo, desno;
        if (s1max[j].empty())
          levo = 0;
        else
          levo = s1max[j].top();
        if (s2max[j].empty())
          desno = 0;
        else
          desno = s2max[j].top();
        sum = sum + max(levo, desno);
        possible[j] = max(levo, desno);
      }
      if (sum <= k) {
        ok = true;
        for (int j = 0; j < m; j++) {
          best[j] = possible[j];
        }
        break;
      }
    }
    if (ok == true)
      l = midpoint + 1;
    else
      r = midpoint - 1;
  }
  for (int i = 0; i < m; i++) {
    printf("%d ", best[i]);
  }
  return 0;
}
