#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
using ll = long long;
int n, m, k;
int a[maxn][6];
struct segtree {
  vector<int> t;
  void init() { t.resize(maxn << 2); }
  void build(vector<int>& v, int node, int b, int e) {
    if (b == e) {
      t[node] = v[b];
      return;
    }
    int mid = (b + e) >> 1;
    build(v, 2 * node, b, mid);
    build(v, 2 * node + 1, mid + 1, e);
    t[node] = max(t[2 * node], t[2 * node + 1]);
  }
  int query(int node, int b, int e, int i, int j) {
    if (i > e or j < b) return 0;
    if (b >= i && j >= e) return t[node];
    int mid = (b + e) >> 1;
    return max(query(2 * node, b, mid, i, j),
               query(2 * node + 1, mid + 1, e, i, j));
  }
} t[5];
bool can(int l, int r) {
  ll sum = 0;
  for (int j = 1; j <= m; ++j) {
    sum += t[j].query(1, 1, n, l, r);
  }
  if (sum <= k) return 1;
  return 0;
}
int main(int argc, char const* argv[]) {
  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]);
    }
  }
  vector<int> v[6];
  for (int j = 1; j <= m; ++j) {
    v[j].push_back(0);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      v[j].push_back(a[i][j]);
    }
  }
  for (int i = 1; i <= m; ++i) {
    t[i].init();
    t[i].build(v[i], 1, 1, n);
  }
  int res = 0, L = 0, R = 0;
  for (int i = 1; i <= n; ++i) {
    int lo = 1, hi = i, ans = -1;
    while (lo <= hi) {
      int mid = (lo + hi) >> 1;
      if (can(mid, i)) {
        hi = mid - 1;
        ans = mid;
      } else {
        lo = mid + 1;
      }
    }
    if (ans != -1) {
      if (i - ans + 1 > res) {
        res = i - ans + 1;
        L = ans;
        R = i;
      }
    }
  }
  for (int j = 1; j <= m; ++j) {
    printf("%d ", t[j].query(1, 1, n, L, R));
  }
  return 0;
}
