#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[200005][10];
int Max[10];
int q[200005][10];
int ans[10];
int front[10], rear[10];
int main() {
  while (scanf("%d%d%d", &n, &m, &k) == 3) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
    int j = 1;
    for (int i = 1; i <= m; i++) {
      Max[i] = -1;
      front[i] = 1, rear[i] = 0;
    }
    memset(ans, 0, sizeof(ans));
    int maxlen = 0;
    int pre = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        while (front[j] <= rear[j] && a[q[rear[j]][j]][j] <= a[i][j]) rear[j]--;
        q[++rear[j]][j] = i;
      }
      while (pre <= i) {
        for (int j = 1; j <= m; j++)
          while (front[j] <= rear[j] && q[front[j]][j] < pre) front[j]++;
        int ret = 0;
        for (int j = 1; j <= m; j++) ret += a[q[front[j]][j]][j];
        if (ret > k)
          pre++;
        else
          break;
      }
      if (i - pre + 1 > maxlen) {
        maxlen = i - pre;
        for (int j = 1; j <= m; j++) ans[j] = a[q[front[j]][j]][j];
      }
    }
    for (int i = 1; i <= m; i++) printf("%d%c", ans[i], i == m ? '\n' : ' ');
  }
  return 0;
}
