#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
using namespace std;
long long n, m, a, b, c, k, temp, x, y;
const int MAXN = 100000 + 11;
int t[4 * MAXN][5];
void build(int a[], int v, int tl, int tr, int index) {
  if (tl == tr) {
    t[v][index] = a[tl];
  } else {
    int tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm, index);
    build(a, v * 2 + 1, tm + 1, tr, index);
    t[v][index] = max(t[v * 2][index], t[v * 2 + 1][index]);
  }
}
int mx(int v, int tl, int tr, int l, int r, int index) {
  if (l > r) return 0;
  if (l == tl && r == tr) {
    return t[v][index];
  }
  int tm = (tl + tr) / 2;
  return max(mx(v * 2, tl, tm, l, min(r, tm), index),
             mx(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, index));
}
void read(vector<long long> &v) {
  for (int i = 0; i < v.size(); i++) cin >> v[i];
}
bool yes(int &mid, int &start) {
  long long count = 0;
  for (int i = 0; i < m; i++) count += mx(1, 0, n - 1, start, mid, i);
  if (count > k) return 0;
  return 1;
}
void solveforthiscase(const int &test) {
  cin >> n;
  cin >> m >> k;
  int a[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int j = 0; j < m; j++) {
    int arr[n];
    for (int i = 0; i < n; i++) arr[i] = a[i][j];
    build(arr, 1, 0, n - 1, j);
  }
  long long ans = 0;
  int index = -1;
  for (int i = 0; i < n; i++) {
    int l = i;
    int r = n - 1;
    int mid;
    while (l <= r) {
      mid = (l + r) / 2;
      if (yes(mid, i))
        l = mid + 1;
      else
        r = mid - 1;
    }
    if (ans < l - i) {
      ans = l - i;
      index = i;
    }
  }
  if (false) cerr << "ans" << ' ' << '=' << ' ' << ans << '\n';
  vector<int> v(m, 0);
  if (index != -1)
    for (int i = 0; i < m; i++) {
      v[i] = mx(1, 0, n - 1, index, index + ans - 1, i);
    }
  for (int i = 0; i < m; i++) cout << v[i] << ' ';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  for (int i = 1; i <= test; i++) {
    solveforthiscase(i);
  }
}
