#include <bits/stdc++.h>
using namespace std;
int sta[10][100005];
int top[10];
int tail[10];
int a[100005][10];
int ans[10];
int main() {
  int n, m;
  int k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= m; i++) {
    top[i] = 1;
  }
  int ma = -1;
  int i = 1;
  for (int l = 1; l <= n; l++) {
    if (l > 1) {
      for (int j = 1; j <= m; j++) {
        if (top[j] <= tail[j] && sta[j][top[j]] < l) {
          top[j]++;
        }
      }
    }
    for (i = max(i, l); i <= n; i++) {
      int sum = 0;
      for (int j = 1; j <= m; j++) {
        sum += max(a[sta[j][top[j]]][j], a[i][j]);
      }
      if (sum > k) break;
      for (int j = 1; j <= m; j++) {
        while (tail[j] >= top[j] && a[sta[j][tail[j]]][j] < a[i][j]) {
          tail[j]--;
        }
        sta[j][++tail[j]] = i;
      }
      if (i - l + 1 > ma) {
        ma = i - l + 1;
        for (int j = 1; j <= m; j++) ans[j] = a[sta[j][top[j]]][j];
      }
    }
  }
  for (int i = 1; i <= m; i++) printf("%d ", ans[i]);
  return 0;
}
