#include <bits/stdc++.h>
using namespace std;
long long PRIME = 1000000007;
long long n, m, k;
long long maxm = (long long)(-10e13);
long long a[100005][6];
long long max_in_range[100005][6][20];
long long ans[6];
long long times(long long length) {
  long long cnt = 0;
  while (length >= 2) {
    length /= 2;
    cnt++;
  }
  return cnt;
}
void calculate(long long index, long long length) {
  long long t = times(length);
  for (long long d = 1; d <= m; d++) {
    ans[d] = max(max_in_range[index][d][t],
                 max_in_range[index + length - (1 << t)][d][t]);
  }
}
long long query(long long index, long long length) {
  long long t = times(length);
  long long sum = 0;
  for (long long d = 1; d <= m; d++) {
    sum += max(max_in_range[index][d][t],
               max_in_range[index + length - (1 << t)][d][t]);
  }
  return sum;
}
long long search(long long index, long long startlength, long long endlength) {
  if (startlength == endlength) {
    return startlength;
  }
  if (endlength - startlength == 1) {
    if (query(index, endlength) <= k) {
      return endlength;
    }
    return startlength;
  }
  long long mid = (startlength + endlength) / 2;
  long long val = query(index, mid);
  if (val > k) {
    return search(index, startlength, mid - 1);
  } else {
    return search(index, mid, endlength);
  }
}
void solve() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  long long maxallowed = 0;
  for (long long p = 0; p < 20; p++) {
    for (long long i = 1; i <= n; i++) {
      long long sum = 0;
      for (long long d = 1; d <= m; d++) {
        if (p == 0) {
          max_in_range[i][d][p] = a[i][d];
        } else if (i + (1 << p) - 1 > n) {
          max_in_range[i][d][p] = (long long)(10e13);
        } else {
          max_in_range[i][d][p] =
              max(max_in_range[i][d][p - 1],
                  max_in_range[i + (1 << (p - 1))][d][p - 1]);
        }
        sum += max_in_range[i][d][p];
      }
      if (sum <= k) {
        maxallowed = p;
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long sum = 0;
    for (long long d = 1; d <= m; d++) {
      sum += max_in_range[i][d][maxallowed];
    }
    if (sum > k) {
      continue;
    } else {
      long long l = search(i, (1 << maxallowed), (1 << (maxallowed + 1)) - 1);
      if (l >= maxm) {
        calculate(i, l);
        maxm = l;
      }
    }
  }
  for (long long d = 1; d <= m; d++) {
    cout << ans[d] << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
