#include <bits/stdc++.h>
using namespace std;
long long m, n;
struct nod {
  long long b[7];
};
nod arr[100010];
nod tree[2000000];
void build_tree(int node, int a, int b) {
  if (a > b) return;
  if (a == b) {
    tree[node] = arr[a];
    return;
  }
  build_tree(node * 2, a, (a + b) / 2);
  build_tree(node * 2 + 1, 1 + (a + b) / 2, b);
  for (long long i = 0; i < m; i++) {
    tree[node].b[i] = max(tree[node * 2].b[i], tree[node * 2 + 1].b[i]);
  }
}
nod temp;
nod query_tree(int node, int a, int b, int i, int j) {
  if (a > b || a > j || b < i) return temp;
  if (a >= i && b <= j) return tree[node];
  nod q1 = query_tree(node * 2, a, (a + b) / 2, i, j);
  nod q2 = query_tree(1 + node * 2, 1 + (a + b) / 2, b, i, j);
  nod res;
  for (long long i = 0; i < m; i++) {
    res.b[i] = max(q1.b[i], q2.b[i]);
  }
  return res;
}
int main() {
  long long k;
  cin >> n >> m >> k;
  long long i, j;
  long long sum = 0;
  long long lef = 0;
  long long maxs = -1;
  long long lefin, rigin;
  nod sma;
  long long to[100010] = {0};
  for (i = 0; i < n; i++) {
    to[i] = 0;
    for (j = 0; j < m; j++) {
      cin >> arr[i].b[j];
      temp.b[j] = -0x7fffffff;
    }
  }
  for (j = 0; j < m; j++) {
    to[0] += arr[0].b[j];
  }
  if (to[0] <= k) {
    maxs = 1;
    lefin = rigin = 0;
  }
  build_tree(1, 0, n - 1);
  for (i = 0; i < n; i++) {
    to[i] = 0;
    sma = query_tree(1, 0, n - 1, lef, i);
    for (j = 0; j < m; j++) {
      to[i] += sma.b[j];
    }
    while (lef < i && to[i] > k) {
      lef++;
      sma = query_tree(1, 0, n - 1, lef, i);
      to[i] = 0;
      for (j = 0; j < m; j++) {
        to[i] += sma.b[j];
      }
    }
    if (to[i] <= k) {
      long long len = i - lef + 1;
      if (len > maxs) {
        lefin = lef;
        rigin = i;
        maxs = len;
      }
    }
  }
  if (maxs != -1) {
    for (i = 0; i < m; i++) {
      long long ma = 0;
      for (j = lefin; j <= rigin; j++) {
        ma = max(ma, arr[j].b[i]);
      }
      cout << ma << " ";
    }
  } else {
    for (i = 0; i < m; i++) {
      cout << "0 ";
    }
  }
}
