#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    void fast_g()
    {
        logs = new int[n+2];
        logs[1] = 0;
        for (int i = 2; i <= n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l+1];
        return min(mn[r][j], mn[l+(1<<j)-1][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l];
        return max(mx[r][j], mx[l+(1<<j)-1][j]);
    }
};

int main()
{
    int aaa;
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        int sum = 0;
        for (int j = 0; j < m; j++) {
            sum += lca[j].fast_max(i, low + 1);
        }
        if (sum <= k) {
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].fast_max(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    void fast_g()
    {
        logs = new int[n+2];
        logs[1] = 0;
        for (int i = 2; i <= n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l+1];
        return min(mn[r][j], mn[l+(1<<j)-1][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l];
        //error(l, r, j, mx[r][j], mx[l+(1<<j)-1][j]);
        return max(mx[r][j], mx[l+(1<<j)][j]);
    }
};

int main()
{
    int aaa;
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        if (low >= i) {
            //error(low, i);
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].fast_max(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    void fast_g()
    {
        logs = new int[n+2];
        logs[1] = 0;
        for (int i = 2; i <= n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l+1];
        return min(mn[r][j], mn[l+(1<<j)-1][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l];
        return max(mx[r][j], mx[l+(1<<j)-1][j]);
    }
};

int main()
{
    int aaa;
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        if (low >= i) {
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].fast_max(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    void fast_g()
    {
        logs = new int[n+1];
        logs[1] = 0;
        for (int i = 2; i <= n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l+1];
        return min(mn[r][j], mn[l+(1<<j)-1][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l+1];
        return max(mx[r][j], mx[l+(1<<j)-1][j]);
    }
};

int main()
{
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        int sum = 0;
        for (int j = 0; j < m; j++) {
            sum += lca[j].fast_max(i, low + 1);
        }
        if (sum <= k) {
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].fast_max(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    void fast_g()
    {
        logs = new int[n+2];
        logs[1] = 0;
        for (int i = 2; i <= n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l+1];
        return min(mn[r][j], mn[l+(1<<j)-1][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l];
        return max(mx[r][j], mx[l+(1<<j)-1][j]);
    }
};

int main()
{
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        int sum = 0;
        for (int j = 0; j < m; j++) {
            sum += lca[j].fast_max(i, low + 1);
        }
        if (sum <= k) {
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].fast_max(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    int *powr;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    /*
        To use array queries:

            Initialize for an array a[n]:
                LCA lca;
                lca.init1(n + 1);
                for (int i = 0; i < n; i++) {
                    lca.addEdge(i, i + 1, a[i]);
                }
                lca.build();
                lca.fast_g(); // Only for O(1) queries

            For query(l, r) where l and r are 0-indexed but any kind of query
            including O(logn) and O(1) ones:
                O(logn):
                    cout << lca.minimum(l, r + 1) << endl;
                    cout << lca.maximum(l, r + 1) << endl;
                    cout << lca.accumulation(l, r + 1) << endl;
                O(1):
                    cout << lca.fast_min(l, r + 1) << endl;
                    cout << lca.fast_max(l, r + 1) << endl;

     */
    void fast_g()
    {
        logs = new int[n];
        powr = new int[LOG];
        logs[1] = 0;
        powr[0] = 1;
        for (int i = 1; i < LOG; i++)
            powr[i] = powr[i-1] * 2;
        for (int i = 2; i < n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l];
        return min(mn[r][j], mn[l+powr[j]][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l];
        return max(mx[r][j], mx[l+powr[j]][j]);
    }
};

int main()
{
    int aaa;
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        if (low >= i) {
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, low + 1);
            }
            if (sum <= k) {
                int temp = low - i + 1;
                if (temp > ans) {
                    ans = temp;
                    for (int j = 0; j < m; j++) {
                        v[j] = lca[j].fast_max(i, low + 1);
    //                    error(j, i, low);
                    }
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    int *logs;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
    void fast_g()
    {
        logs = new int[n+2];
        logs[1] = 0;
        for (int i = 2; i <= n; i++)
            logs[i] = logs[i/2] + 1;
    }
    int fast_min(int l, int r)
    {
        int j = logs[r-l+1];
        return min(mn[r][j], mn[l+(1<<j)-1][j]);
    }
    int fast_max(int l, int r)
    {
        int j = logs[r-l+1];
        return max(mx[r][j], mx[l+(1<<j)-1][j]);
    }
};

int main()
{
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
        lca[i].fast_g();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].fast_max(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        int sum = 0;
        for (int j = 0; j < m; j++) {
            sum += lca[j].fast_max(i, low + 1);
        }
        if (sum <= k) {
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].fast_max(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
//    error(ans);
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

#define     LL                      long long int
#define     LD                      long double
#define     ULL                     unsigned long long int

#define     pii                     pair<int, int>
#define     ump                     unordered_map
#define     mp                      make_pair
#define     mt                      make_tuple
#define     pb                      push_back
#define     ff                      first
#define     ss                      second
#define     SZ(x)                   (int)x.size()
#define     all(x)                  x.begin(), x.end()
#define     lb(x, y)                lower_bound(all(x), y)
#define     fill2d(arr, a, b, v)    fill(&arr[0][0], &arr[0][0] + a * b, v)
#define     fill3d(arr, a, b, c, v) fill(&arr[0][0], &arr[0][0] + a * b * c, v)
#define     rep(i, begin, end)      for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define     sp(x)                   setprecision(x) << fixed
#define     what_is(x)              cout << #x << " is " << x << endl
//#define     I64                     ll

#define     PI                      acos(-1.0)
#define     EPS                     1e-12
//#define     mx                      200010
#define     S_SIZE                  2000010

const LL inf = 1000000000;
const LL mod = 1000000000 + 7;

inline void IO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
inline int dcmp (LD x) { return x < -EPS ? -1 : (x > EPS); }

template<class T> inline int CHECK(T MASK, int i) { return (MASK >> i) & 1; }
template<class T> inline T ON(T MASK, int i) { return MASK | (T(1) << i); }
template<class T> inline T OFF(T MASK, int i) { return MASK & (~(T(1) << i)); }
template<typename T> inline int CNT(T MASK) {
    if (numeric_limits<T>::digits <= numeric_limits<unsigned int>::digits) return __builtin_popcount(MASK);
    else return __builtin_popcountll(MASK);
}
template<class T> inline int RIGHT(T MASK) { return log2(MASK & -MASK); }

int dx4[] = { 0, 0, -1, +1 }; int dy4[] = { +1, -1, 0, 0 };
int dx8[] = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; int dy8[] = { 0, 1, 1, 1, 0, -1, -1, -1, 0 };

inline void I(int& a) { scanf("%d", &a); } inline void I(LL& a) { scanf("%I64d", &a); }
inline void I(ULL& a) { scanf("%I64u", &a); } inline void I(char* a) { scanf("%s", a); }
char Iarr[S_SIZE]; inline void I(string& a) { scanf("%s", Iarr); a = Iarr; }
template<typename T, typename... Args>
void I(T& a, Args&... args) { I(a); I(args...); }

inline void OUT(int a) { printf("%d", a); } inline void OUT(LL a) { printf("%I64d", a); }
inline void OUT(const char* a) { printf("%s", a); } inline void OUT(char* a) { printf("%s", a); }
inline void OUT(bool a) { printf("%d", a); } inline void OUT(string a) { rep(it, a.begin(), a.end()) printf("%c", *it); }
inline void OUT(ULL a) { printf("%I64u", a); }
template<typename T, typename... Args>
void OUT(T a, Args... args) { OUT(a); OUT(" "); OUT(args...); }
template<typename... Args>
void O(Args... args) { OUT(args...); OUT("\n"); }

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, pair<T1, T2> p) { os << "{" << p.first << ", " << p.second << "}"; return os; }
template<typename T>
inline ostream& operator<<(ostream& os, vector<T>& a) { os << "["; for (int i = 0; i < (int)a.size(); i++) { if (i) os << ", "; os << a[i]; } os << "]"; return os; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}

// mp.reserve(1024); mp.max_load_factor(0.25);
// head

const int M = 200010; // maximum number of cubes

struct LCA
{
    /* 0 indexed */
    int n;
    int *l;
    int **p;
    int **mn;
    int **mx;
    LL **sum;
    /* parent, min, max, sum */
    int LOG;
    vector<pii > *g;
    void init1(int nn)
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
    }
    void init2(int nn, vector<pii> gg[])
    {
        n = nn;
        l = new int[nn];
        p = new int*[nn];
        mn = new int*[nn];
        mx = new int*[nn];
        sum = new LL*[nn];
        LOG = log2(nn) + 2;
        for (int i = 0; i < nn; i++) {
            p[i] = new int[LOG];
            mn[i] = new int[LOG];
            mx[i] = new int[LOG];
            sum[i] = new LL[LOG];
        }
        g = new vector<pii >[nn];
        for (int i = 0; i < nn; i++) {
            for (auto x : gg[i]) {
                g[i].push_back(x);
            }
        }
    }
    void addEdge(int u, int v, int w)
    {
        g[u].push_back(mp(v, w));
        g[v].push_back(mp(u, w));
    }
    void dfs(int u, int pp, int ll)
    {
        l[u] = ll;
        p[u][0] = pp;
        for (auto x : g[u]) {
            if (x.ff != pp) {
                mn[x.ff][0] = mx[x.ff][0] = sum[x.ff][0] = x.ss;
                dfs(x.ff, u, ll + 1);
            }
        }
    }
    void build()
    {
        dfs(0, -1, 0);
        for (int i = 1; i < LOG; i++) {
            for (int j = 0; j < n; j++) {
                if (p[j][i-1] != -1) {
                    mn[j][i] = min(mn[j][i-1], mn[p[j][i-1]][i-1]);
                    mx[j][i] = max(mx[j][i-1], mx[p[j][i-1]][i-1]);
                    sum[j][i] = sum[j][i-1] + sum[p[j][i-1]][i-1];
                    p[j][i] = p[p[j][i-1]][i-1];
                }
                else {
                    p[j][i] = -1;
                    mn[j][i] = INT_MAX;
                    mx[j][i] = INT_MIN;
                    sum[j][i] = 0;
                }
            }
        }
    }
    int lca(int u, int v)
    {
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                v = p[v][i];
            }
        }
        if (u == v) return u;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                u = p[u][i];
                v = p[v][i];
            }
        }
        return p[u][0];
    }
    int minimum(int u, int v)
    {
        int ret = INT_MAX;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = min(ret, mn[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = min(ret, mn[u][i]);
                ret = min(ret, mn[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = min(ret, mn[u][0]);
        ret = min(ret, mn[v][0]);
        return ret;
    }
    int maximum(int u, int v)
    {
        int ret = INT_MIN;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret = max(ret, mx[v][i]);
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret = max(ret, mx[u][i]);
                ret = max(ret, mx[v][i]);
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret = max(ret, mx[u][0]);
        ret = max(ret, mx[v][0]);
        return ret;
    }
    LL accumulation(int u, int v)
    {
        LL ret = 0;
        if (l[u] > l[v])
            swap(u, v);
        int d = l[v] - l[u];
        for (int i = 0; i < LOG; i++) {
            if (CHECK(d, i)) {
                ret += sum[v][i];
                v = p[v][i];
            }
        }
        if (u == v) return ret;
        for (int i = LOG - 1; i >= 0; i--) {
            if (p[u][i] != p[v][i]) {
                ret += sum[u][i];
                ret += sum[v][i];
                u = p[u][i];
                v = p[v][i];
            }
        }
        ret += sum[u][0];
        ret += sum[v][0];
        return ret;
    }
};

int main()
{
    int n, m, k;
    I(n, m, k);
    int a[n][m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            I(a[i][j]);
        }
    }
    LCA lca[m];
    for (int i = 0; i < m; i++) {
        lca[i].init1(n + 1);
        for (int j = 0; j < n; j++) {
            lca[i].addEdge(j, j + 1, a[j][i]);
        }
        lca[i].build();
    }
    int ans = INT_MIN;
    vector<int> v(m);
    for (int i = 0; i < n; i++) {
        int low = i, high = n - 1;
        bool ok = 0;
        while (low < high) {
            int mid = (low + high + 1) / 2;
            int sum = 0;
            for (int j = 0; j < m; j++) {
                sum += lca[j].maximum(i, mid + 1);
            }
            if (sum <= k) {
                low = mid;
            }
            else {
                high = mid - 1;
            }
        }
        int sum = 0;
        for (int j = 0; j < m; j++) {
            sum += lca[j].maximum(i, low + 1);
        }
        if (sum <= k) {
            int temp = low - i + 1;
            if (temp > ans) {
                ans = temp;
                for (int j = 0; j < m; j++) {
                    v[j] = lca[j].maximum(i, low + 1);
//                    error(j, i, low);
                }
            }

        }
    }
    for (int i = 0; i < m; i++) {
        printf("%d ", v[i]);
    }
//    error(lca[0].maximum(0, 5));

    return 0;
}


//#define _DLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define ff first
#define ss second
#define _ << " " <<

const int MAXN = 1e5 + 5, MAXM = 5;

vector<vector<ll> > a(MAXN, vector<ll>(MAXM));
vector<vector<ll> > t(MAXN * 4, vector<ll>(MAXM));

vector<ll> f(vector<ll> x, vector<ll> y) {
	vector<ll> ans(MAXM);
	for (int i = 0; i < MAXM; ++i) {
		ans[i] = max(x[i], y[i]);
	}
	return ans;
}

void build(int i, int l, int r) {
	if (l == r - 1) {
		//cout << "---" << endl;
		//cout << l _ i << endl;
		for (int j = 0; j < MAXM; ++j) {
			t[i][j] += a[l][j];
			//cout << "!" _ j _ t[i][j] << endl;
		}
		return;
	}

	int m = (l + r) / 2;
	build(i * 2 + 1, l, m);
	build(i * 2 + 2, m, r);
	t[i] = f(t[i * 2 + 1], t[i * 2 + 2]);
}

vector<ll> get(int i, int l, int r, int ql, int qr) {
	if (l >= qr || ql >= r) {
		vector<ll> ans(5);
		return ans;
	}
	if (ql <= l && r <= qr) {
		return t[i];
	}

	int m = (l + r) / 2;
	return f(get(i * 2 + 1, l, m, ql, qr), get(i * 2 + 2, m, r, ql, qr));
}

ll get_cnt(vector<ll> v) {
	ll ans = 0;
	for (auto to : v) {
		ans += to;
	}
	return ans;
}

vector<ll> check(int tmp, ll k, ll n) {
	vector<ll> ans;
	for (int i = tmp; i <= n; ++i) {
		ans = get(0, 0, n, i - tmp, i);
		/*cout << "----" << endl;
		cout << i - tmp _ i << endl;
		for (auto to : ans) {
			cout << to << " ";
		}
		cout << endl;
		cout << get_cnt(ans) << endl;*/
		if (get_cnt(ans) <= k) {
			return ans;
		}
	}
	return {-1, -1, -1, -1, -1};
}

void solve() {
	ll n, m, k, x;
	cin >> n >> m >> k;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> x;
			a[i][j] = x;
		}
	}
	build(0, 0, n);

	vector<ll> ans = {-1}, tmp;
	int l = 1, r = n + 1, mid;
	while (r - l > 1) {
		mid = (l + r) / 2;
		//cout << "!!!" _ mid << endl;
		tmp = check(mid, k, n);
		if (tmp[0] != -1) {
			l = mid;
			ans = tmp;
			/*cout << "****" _ l << endl;
			for (auto to : ans) {
				cout << to << " ";
			}
			cout << endl;*/
		} else {
			r = mid;
		}
		//cout << "!!" _ l _ r << endl;
	}
	if (ans[0] == -1) {
		for (int i = 0; i < m; ++i) {
			cout << 0 << " ";
		}
		exit(0);
	}
	for (int i = 0; i < m; ++i) {
		cout << ans[i] << " ";
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}


//#define _DLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define ff first
#define ss second
#define _ << " " <<

const int MAXN = 1e5 + 5, MAXM = 5;

vector<vector<ll> > a(MAXN, vector<ll>(MAXM));
vector<vector<ll> > t(MAXN * 4, vector<ll>(MAXM));

vector<ll> f(vector<ll> x, vector<ll> y) {
	vector<ll> ans(MAXM);
	for (int i = 0; i < MAXM; ++i) {
		ans[i] = max(x[i], y[i]);
	}
	return ans;
}

void build(int i, int l, int r) {
	if (l == r - 1) {
		//cout << "---" << endl;
		//cout << l _ i << endl;
		for (int j = 0; j < MAXM; ++j) {
			t[i][j] += a[l][j];
			//cout << "!" _ j _ t[i][j] << endl;
		}
		return;
	}

	int m = (l + r) / 2;
	build(i * 2 + 1, l, m);
	build(i * 2 + 2, m, r);
	t[i] = f(t[i * 2 + 1], t[i * 2 + 2]);
}

vector<ll> get(int i, int l, int r, int ql, int qr) {
	if (l >= qr || ql >= r) {
		vector<ll> ans(5);
		return ans;
	}
	if (ql <= l && r <= qr) {
		return t[i];
	}

	int m = (l + r) / 2;
	return f(get(i * 2 + 1, l, m, ql, qr), get(i * 2 + 2, m, r, ql, qr));
}

ll get_cnt(vector<ll> v) {
	ll ans = 0;
	for (auto to : v) {
		ans += to;
	}
	return ans;
}

vector<ll> check(int tmp, ll k, ll n) {
	vector<ll> ans;
	for (int i = tmp; i <= n; ++i) {
		ans = get(0, 0, n, i - tmp, i);
		/*cout << "----" << endl;
		cout << i - tmp _ i << endl;
		for (auto to : ans) {
			cout << to << " ";
		}
		cout << endl;
		cout << get_cnt(ans) << endl;*/
		if (get_cnt(ans) <= k) {
			return ans;
		}
	}
	return {-1, -1, -1, -1, -1};
}

void solve() {
	ll n, m, k, x;
	cin >> n >> m >> k;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> x;
			a[i][j] = x;
		}
	}
	build(0, 0, n);

	vector<ll> ans, tmp;
	int l = 0, r = n + 1, mid;
	while (r - l > 1) {
		mid = (l + r) / 2;
		tmp = check(mid, k, n);
		if (tmp[0] != -1) {
			l = mid;
			ans = tmp;
			/*cout << "****" _ l << endl;
			for (auto to : ans) {
				cout << to << " ";
			}
			cout << endl;*/
		} else {
			r = mid;
		}
	}

	for (int i = 0; i < m; ++i) {
		cout << ans[i] << " ";
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}


//#define _DLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define ff first
#define ss second
#define _ << " " <<

const int MAXN = 1e5 + 5, MAXM = 5;

vector<vector<ll> > a(MAXN, vector<ll>(MAXM));
vector<vector<ll> > t(MAXN * 4, vector<ll>(MAXM));

vector<ll> f(vector<ll> x, vector<ll> y) {
	vector<ll> ans(MAXM);
	for (int i = 0; i < MAXM; ++i) {
		ans[i] = max(x[i], y[i]);
	}
	return ans;
}

void build(int i, int l, int r) {
	if (l == r - 1) {
		//cout << "---" << endl;
		//cout << l _ i << endl;
		for (int j = 0; j < MAXM; ++j) {
			t[i][j] += a[l][j];
			//cout << "!" _ j _ t[i][j] << endl;
		}
		return;
	}

	int m = (l + r) / 2;
	build(i * 2 + 1, l, m);
	build(i * 2 + 2, m, r);
	t[i] = f(t[i * 2 + 1], t[i * 2 + 2]);
}

vector<ll> get(int i, int l, int r, int ql, int qr) {
	if (l >= qr || ql >= r) {
		vector<ll> ans(5);
		return ans;
	}
	if (ql <= l && r <= qr) {
		return t[i];
	}

	int m = (l + r) / 2;
	return f(get(i * 2 + 1, l, m, ql, qr), get(i * 2 + 2, m, r, ql, qr));
}

ll get_cnt(vector<ll> v) {
	ll ans = 0;
	for (auto to : v) {
		ans += to;
	}
	return ans;
}

vector<ll> check(int tmp, int k, int n) {
	vector<ll> ans;
	for (int i = tmp; i <= n; ++i) {
		ans = get(0, 0, n, i - tmp, i);
		/*cout << "----" << endl;
		cout << i - tmp _ i << endl;
		for (auto to : ans) {
			cout << to << " ";
		}
		cout << endl;
		cout << get_cnt(ans) << endl;*/
		if (get_cnt(ans) <= k) {
			return ans;
		}
	}
	return {-1, -1, -1, -1, -1};
}

void solve() {
	ll n, m, k, x;
	cin >> n >> m >> k;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> x;
			a[i][j] = x;
		}
	}
	build(0, 0, n);

	vector<ll> ans, tmp;
	int l = 0, r = n, mid;
	while (r - l > 1) {
		mid = (l + r) / 2;
		tmp = check(mid, k, n);
		if (tmp[0] != -1) {
			l = mid;
			ans = tmp;
			/*cout << "****" _ l << endl;
			for (auto to : ans) {
				cout << to << " ";
			}
			cout << endl;*/
		} else {
			r = mid;
		}
	}

	for (int i = 0; i < m; ++i) {
		cout << ans[i] << " ";
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}


//#define _DLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define ff first
#define ss second
#define _ << " " <<

priority_queue<pair<int,int> >pq[5];

void solve() {
	int n, m, k, u, temp, ret = 0;
	cin >> n >> m >> k;

	vector<int> v(5);
	int l = 0, r = 0;
	for (int i = 0; i < n; ++i) {
		r = i;
		for (int j = 0; j < m; ++j) {
			cin >> u;
			pq[j].push({u, i});
		}

		while (l <= r) {
			temp = 0;
			for (int j = 0; j < m; ++j) {
				while (pq[j].top().ss < l) {
					pq[j].pop();
				}
				temp += pq[j].top().ff;
			}

			if (temp <= k) break;
			++l;
		}

		if (r - l  +1 > ret) {
			ret = r - l + 1;
			for (int j = 0; j < m; ++j) {
				v[j] = pq[j].top().ff;
			}
		}
	}
	for (int j = 0; j < m; ++j) {
		cout << v[j] << " ";
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}


//#define _DLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define ff first
#define ss second
#define _ << " " <<

priority_queue<pair<int,int> >pq[5];

void solve() {
	int n, m, k, u, temp, ret = 0;
	cin >> n >> m >> k;

	vector<int> v(5);
	int l = 0, r = 0;
	for (int i = 0; i < n; ++i) {
		r = i;
		for (int j = 0; j < m; ++j) {
			cin >> u;
			pq[j].push({u, i});
		}

		while (l <= r) {
			temp = 0;
			for (int j = 0; j < m; ++j) {
				while (pq[j].top().ss < l) {
					pq[j].pop();
				}
				temp += pq[j].top().ff;
			}

			if (temp <= k) break;
			++l;
		}

		if (r - l  +1 > ret) {
			ret = r - l + 1;
			for (int j = 0; j < m; ++j) {
				v[j] = pq[j].top().ff;
			}
		}
	}
	for (int j = 0; j < m; ++j) {
		cout << v[j] << " ";
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}


//#define _DLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define ff first
#define ss second
#define _ << " " <<

const int MAXN = 1e5 + 5, MAXM = 5;

vector<vector<ll> > a(MAXN, vector<ll>(MAXM));
vector<vector<ll> > t(MAXN * 4, vector<ll>(MAXM));

vector<ll> f(vector<ll> x, vector<ll> y) {
	vector<ll> ans(MAXM);
	for (int i = 0; i < MAXM; ++i) {
		ans[i] = max(x[i], y[i]);
	}
	return ans;
}

void build(int i, int l, int r) {
	if (l == r - 1) {
		//cout << "---" << endl;
		//cout << l _ i << endl;
		for (int j = 0; j < MAXM; ++j) {
			t[i][j] += a[l][j];
			//cout << "!" _ j _ t[i][j] << endl;
		}
		return;
	}

	int m = (l + r) / 2;
	build(i * 2 + 1, l, m);
	build(i * 2 + 2, m, r);
	t[i] = f(t[i * 2 + 1], t[i * 2 + 2]);
}

vector<ll> get(int i, int l, int r, int ql, int qr) {
	if (l >= qr || ql >= r) {
		vector<ll> ans(5);
		return ans;
	}
	if (ql <= l && r <= qr) {
		return t[i];
	}

	int m = (l + r) / 2;
	return f(get(i * 2 + 1, l, m, ql, qr), get(i * 2 + 2, m, r, ql, qr));
}

ll get_cnt(vector<ll> v) {
	ll ans = 0;
	for (auto to : v) {
		ans += to;
	}
	return ans;
}

vector<ll> check(int tmp, ll k, ll n) {
	vector<ll> ans;
	for (int i = tmp; i <= n; ++i) {
		ans = get(0, 0, n, i - tmp, i);
		/*cout << "----" << endl;
		cout << i - tmp _ i << endl;
		for (auto to : ans) {
			cout << to << " ";
		}
		cout << endl;
		cout << get_cnt(ans) << endl;*/
		if (get_cnt(ans) <= k) {
			return ans;
		}
	}
	return {-1, -1, -1, -1, -1};
}

void solve() {
	ll n, m, k, x;
	cin >> n >> m >> k;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> x;
			a[i][j] = x;
		}
	}
	build(0, 0, n);

	vector<ll> ans = {-1}, tmp;
	int l = 0, r = n + 1, mid;
	while (r - l > 1) {
		mid = (l + r) / 2;
		//cout << "!!!" _ mid << endl;
		tmp = check(mid, k, n);
		if (tmp[0] != -1) {
			l = mid;
			ans = tmp;
			/*cout << "****" _ l << endl;
			for (auto to : ans) {
				cout << to << " ";
			}
			cout << endl;*/
		} else {
			r = mid;
		}
		//cout << "!!" _ l _ r << endl;
	}
	if (ans[0] == -1) {
		for (int i = 0; i < m; ++i) {
			cout << 0 << " ";
		}
		exit(0);
	}
	for (int i = 0; i < m; ++i) {
		cout << ans[i] << " ";
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}


#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    ll k;
    cin>>n>>m>>k;
    vector<multiset<int>> cnt(m),ans(m);
    int mxlen=0;
    ll sum=0;
    vector a(n,vector(m,0));
    for(auto& v:a){
        for(auto& it:v) cin>>it;
    }
    int r=0;
    for(int l=0;l<n;l++){
        while(r<n+1&&sum<=k){
            if(r-l>mxlen){
                mxlen=r-l;
                ans=cnt;
            }
            if(r==n) break;
            sum=0;
            forn(i,m){
                cnt[i].insert(a[r][i]);
                sum+=*cnt[i].rbegin();
            }
            r++;
        }
        sum=0;
        forn(i,m){
            cnt[i].erase(cnt[i].find(a[l][i]));
            if(!cnt[i].empty()) sum+=*cnt[i].rbegin();
        }
    }
    forn(i,m) cout<<(ans[i].empty()?0:*ans[i].rbegin())<<' ';
    return 0;
}


#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m;
    ll k;
    cin>>n>>m>>k;
    vector<multiset<int>> cnt(m),ans(m);
    int mxlen=0;
    ll sum=0;
    vector a(n,vector(m,0));
    for(auto& v:a){
        for(auto& it:v) cin>>it;
    }
    int r=0;
    for(int l=0;l<n;l++){
        while(r<n&&sum<=k){
            if(r-l>mxlen){
                mxlen=r-l;
                ans=cnt;
            }
            sum=0;
            forn(i,m){
                cnt[i].insert(a[r][i]);
                sum+=*cnt[i].rbegin();
            }
            r++;
        }
        sum=0;
        forn(i,m){
            cnt[i].erase(cnt[i].find(a[l][i]));
            if(!cnt[i].empty()) sum+=*cnt[i].rbegin();
        }
    }
    forn(i,m) cout<<(ans[i].empty()?0:*ans[i].rbegin())<<' ';
    return 0;
}