import java.io.BufferedOutputStream ;
import java.io.BufferedReader ;
import java.io.FileInputStream ;
import java.io.FileNotFoundException ;
import java.io.FileOutputStream ;
import java.io.IOException ;
import java.io.InputStream ;
import java.io.InputStreamReader ;
import java.io.OutputStream ;
import java.io.PrintWriter ;
import java.util.Arrays ;
import java.util.StringTokenizer ;
public class Main {
public static void main
( String [ ] args
) { try {
}
Kattio io = new Kattio( input, output) ;
//int t=io.getInt();
//for (int i=1; i<=t; i++)
( new Solve( io) ) .main ( ) ;
io.close ( ) ;
try {
input.close ( ) ;
}
try {
output.close ( ) ;
}
}
}
class RMQ
{
int n;
int [ ] arr;
int [ ] l,r;
int [ ] dat;
int [ ] pos;
public RMQ( int n)
{
this .n = n;
arr = new int [ n+ 1 ] ;
dat = new int [ 4 * n+ 1 ] ;
l = new int [ 4 * n+ 1 ] ;
r = new int [ 4 * n+ 1 ] ;
pos = new int [ n+ 1 ] ;
RMQHelper( 1 ,1 ,n) ;
}
private void RMQHelper( int i,int x,int y)
{
l[ i] = x;
r[ i] = y;
if ( x== y)
{
dat[ i] = arr[ x] ;
pos[ x] = i;
}
else
{
int m= ( x+ y) / 2 ;
RMQHelper( i* 2 ,x,m) ;
RMQHelper( i* 2 + 1 ,m+ 1 ,y) ;
dat
[ i
] = Math .
max ( dat
[ i
* 2 ] , dat
[ i
* 2 + 1 ] ) ; }
}
public void update( int x,int y)
{
arr[ x] = y;
dat[ pos[ x] ] = y;
updateHelper( pos[ x] / 2 ) ;
}
private void updateHelper( int x)
{
if ( x== 0 ) return ;
dat
[ x
] = Math .
max ( dat
[ x
* 2 ] ,dat
[ x
* 2 + 1 ] ) ; updateHelper( x/ 2 ) ;
}
public int get( int l,int r)
{
return getHelper( 1 ,l,r) ;
}
private int getHelper( int i,int x,int y)
{
int res;
if ( y< l[ i] || x> r[ i] ) res= 0 ;
else
if ( x<= l[ i] && r[ i] <= y) res= dat[ i] ;
else
{
res= getHelper( i* 2 ,x,y) ;
res
= Math .
max ( res,getHelper
( i
* 2 + 1 ,x,y
) ) ; }
return res;
}
@Override
return "RMQ [n=" + n
+ ", arr=" + Arrays .
toString ( arr
) + ", l=" + Arrays .
toString ( l
) + ", r=" + Arrays .
toString ( r
) + ", dat=" + Arrays .
toString ( dat
) + ", pos=" + Arrays .
toString ( pos
) + "]" ; }
}
class Solve {
Kattio io;
int n,m,k;
int [ ] [ ] a;
RMQ[ ] ds;
Solve( Kattio io) {
this .io = io;
}
boolean check( int l,int r)
{
if ( r> n) return false ;
int sum = 0 ;
for ( int i= 1 ; i<= m; i++ )
sum+= ds[ i] .get ( l, r) ;
return ( sum<= k) ;
}
void main( ) {
n= io.getInt ( ) ;
m= io.getInt ( ) ;
k= io.getInt ( ) ;
a = new int [ n+ 1 ] [ m+ 1 ] ;
for ( int i= 1 ; i<= n; i++ )
for ( int j= 1 ; j<= m; j++ )
a[ i] [ j] = io.getInt ( ) ;
ds = new RMQ[ m+ 1 ] ;
for ( int i= 1 ; i<= m; i++ )
{
ds[ i] = new RMQ( n) ;
for ( int j= 1 ; j<= n; j++ )
ds[ i] .update ( j, a[ j] [ i] ) ;
}
//for (int i=1; i<=m; i++)
// io.println(ds[i]);
int res = 0 ;
int vtres = 0 ;
for ( int i= 1 ; i<= n; i++ )
{
int dau = i, cuoi = n;
do
{
int giua= ( dau+ cuoi) / 2 ;
if ( check( i,giua) ) dau= giua+ 1 ;
else cuoi= giua- 1 ;
}
while ( dau<= cuoi) ;
if ( cuoi- i+ 1 > res)
{
res= cuoi- i+ 1 ;
vtres= i;
}
}
for ( int i= 1 ; i<= m; i++ )
io.print ( ds[ i] .get ( vtres,vtres+ res- 1 ) + " " ) ;
}
}
}
}
public boolean hasMoreTokens( ) {
return peekToken( ) != null ;
}
public int getInt( ) {
return Integer .
parseInt ( nextToken
( ) ) ; }
public double getDouble( ) {
return Double .
parseDouble ( nextToken
( ) ) ; }
public long getLong( ) {
return Long .
parseLong ( nextToken
( ) ) ; }
return nextToken( ) ;
}
if ( token == null )
try {
while ( st == null || ! st.hasMoreTokens ( ) ) {
line = r.readLine ( ) ;
if ( line == null )
return null ;
}
token = st.nextToken ( ) ;
}
return token;
}
token = null ;
return ans;
}
}
aW1wb3J0IGphdmEuaW8uQnVmZmVyZWRPdXRwdXRTdHJlYW07CmltcG9ydCBqYXZhLmlvLkJ1ZmZlcmVkUmVhZGVyOwppbXBvcnQgamF2YS5pby5GaWxlSW5wdXRTdHJlYW07CmltcG9ydCBqYXZhLmlvLkZpbGVOb3RGb3VuZEV4Y2VwdGlvbjsKaW1wb3J0IGphdmEuaW8uRmlsZU91dHB1dFN0cmVhbTsKaW1wb3J0IGphdmEuaW8uSU9FeGNlcHRpb247CmltcG9ydCBqYXZhLmlvLklucHV0U3RyZWFtOwppbXBvcnQgamF2YS5pby5JbnB1dFN0cmVhbVJlYWRlcjsKaW1wb3J0IGphdmEuaW8uT3V0cHV0U3RyZWFtOwppbXBvcnQgamF2YS5pby5QcmludFdyaXRlcjsKaW1wb3J0IGphdmEudXRpbC5BcnJheXM7CmltcG9ydCBqYXZhLnV0aWwuU3RyaW5nVG9rZW5pemVyOwoKcHVibGljIGNsYXNzIE1haW4gewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCUlucHV0U3RyZWFtIGlucHV0OwoJCU91dHB1dFN0cmVhbSBvdXRwdXQ7CgkJdHJ5IHsKCQkJaW5wdXQgPSBuZXcgRmlsZUlucHV0U3RyZWFtKCJpbnB1dC50eHQiKTsKCQkJb3V0cHV0ID0gbmV3IEZpbGVPdXRwdXRTdHJlYW0oIm91dHB1dC50eHQiKTsKCQl9IGNhdGNoIChGaWxlTm90Rm91bmRFeGNlcHRpb24gZSkgewoJCQlpbnB1dCA9IFN5c3RlbS5pbjsKCQkJb3V0cHV0ID0gU3lzdGVtLm91dDsKCQl9CgkJS2F0dGlvIGlvID0gbmV3IEthdHRpbyhpbnB1dCwgb3V0cHV0KTsKCQkvL2ludCB0PWlvLmdldEludCgpOwoJCS8vZm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