An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of maximum length. He has m weapons, the i-th weapon can affect all the droids in the army by destroying one detail of the i-th type (if the droid doesn't have details of this type, nothing happens to it). 

A droid is considered to be destroyed when all of its details are destroyed. R2-D2 can make at most k shots. How many shots from the weapon of what type should R2-D2 make to destroy the sequence of consecutive droids of maximum length?

Input

The first line contains three integers n, m, k (1 ≤ n ≤ 105, 1 ≤ m ≤ 5, 0 ≤ k ≤ 109) — the number of droids, the number of detail types and the number of available shots, respectively.

Next n lines follow describing the droids. Each line contains m integers a1, a2, ..., am (0 ≤ ai ≤ 108), where ai is the number of details of the i-th type for the respective robot.

Output

Print m space-separated integers, where the i-th number is the number of shots from the weapon of the i-th type that the robot should make to destroy the subsequence of consecutive droids of the maximum length.

If there are multiple optimal solutions, print any of them. 

It is not necessary to make exactly k shots, the number of shots can be less.

Examples

Input

5 2 4
4 0
1 2
2 1
0 2
1 3


Output

2 2


Input

3 2 4
1 2
1 3
2 2


Output

1 3

Note

In the first test the second, third and fourth droids will be destroyed. 

In the second test the first and second droids will be destroyed.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.PriorityQueue;


public class CF_291_D {
    
    private static int n, m, k;
    private static int MAX_IND;//+1 bec it is one based not zero, MAX_IND =  1<<(h+1)+1;

    private static int[][] segmentTree;
    private static int[][] arr;
    
    private static boolean predicate(int[][] arr, int range, int n, int m, int k){
        
        /* rolling */
        long sum;
        for(int i = 0, j = range - 1 ; j < n ; ++i, ++j){
            sum = 0;
            for(int l = 0 ; l < m ; ++l){
                //System.out.println(l+"   "+i+"    "+j+"    --> "+query(1, 0, n - 1, i, j, l));
                sum += arr[query(1, 0, n - 1, i, j, l)][l];
            }
            if(sum <= k)return true;
        }
        
        return false;
    }
    
    private static int[] getSolution(int[][] arr, int range, int n, int m, int k){
        
        
        int[] max_Ms = new int[m];
        
        /* rolling */
        long sum;
        for(int i = 0, j = range - 1 ; j < n ; ++i, ++j){
            sum = 0;
            for(int l = 0 ; l < m ; ++l){
                sum += arr[query(1, 0, n - 1, i, j, l)][l];
            }
            if(sum <= k){
                for(int l = 0 ; l < m ; ++l){
                    max_Ms[l] = arr[query(1, 0, n - 1, i, j, l)][l];
                }
                return max_Ms;
            }
        }
        
        
        return null;
    }
    
    private static void build(int currentNode, int start, int end, int index){
        if(start == end){
            segmentTree[currentNode][index] = start;
        }else{
            //compute the left sub tree
            build(2*currentNode, start, (start + end)/2, index);
            //compute the right sub tree
            build(2*currentNode+1, (start + end)/2 + 1, end, index);
            //search for the minimum value in the first and second half of the interval
            if(arr[segmentTree[2*currentNode][index]][index] > arr[segmentTree[2*currentNode+1][index]][index]){
                segmentTree[currentNode][index] = segmentTree[2*currentNode][index];
            }else{
                segmentTree[currentNode][index] = segmentTree[2*currentNode+1][index];
            }
        }
    }

    private static int query(int currentNode, int start, int end, int i, int j, int index){
        if(j < start || i > end){//this node is node included with u
            return -1;
        }
        
        //if the current interval is included in, the query interval return M[node]
        if(start >= i && end <= j){
            return segmentTree[currentNode][index];
        }
        //branching in the left and right
        int p1 = query(2*currentNode, start, (start + end)/2, i, j, index);
        int p2 = query(2*currentNode+1, (start + end)/2+1, end,  i, j, index);
        
        if(p1 == -1){
            return  p2;
        }else if(p2 == -1){
            return p1;
        }
        
        if(arr[p1][index] > arr[p2][index]){
            return p1;
        }
        return p2;
    }

    public static void main(String[] args) throws IOException{
        PrintWriter pw = new PrintWriter(System.out, true);
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n, m, k;
        String[] line = input.readLine().split(" ");
        n = Integer.parseInt(line[0]);
        m = Integer.parseInt(line[1]);
        k = Integer.parseInt(line[2]);
        MAX_IND = 4*n + 1;
        arr = new int[n][m];
        segmentTree = new int[MAX_IND][m];
        //System.out.println(MAX_IND);
        /* input */
        for(int i = 0 ; i < n ; ++i){
            line = input.readLine().split(" ");
            for(int j = 0 ; j < m ; ++j){
                arr[i][j] = Integer.parseInt(line[j]);
            }
        }
        
        /* intialize the segment tree */
        for(int i = 0 ; i < MAX_IND ; ++i){
            for(int j = 0 ; j < m ; ++j){
                segmentTree[i][j] = -1;
            }
        }
        for(int i = 0 ; i < m ; ++i){
            build(1, 0, arr.length-1, i);
        }
    
    //  System.out.println(arr[query(1, 0, arr.length-1, 1, 4, 0)][0]);
        
    
        int lo = 0, hi = n, mid;
        
        while(lo < hi){
            mid = lo + (hi - lo + 1)/2;
        
            if(predicate(arr, mid, n, m, k)){
                lo = mid;
            }else{
                hi = mid - 1;
            }
        }
        
        if(lo == 0){
            for(int i = 0 ; i < m-1 ; ++i){
                pw.print(0+" ");
            }
            pw.println(0);
        }else{
            int[] ans = getSolution(arr, lo, n, m, k);
            
            for(int i = 0 ; i < m-1 ; ++i){
                pw.print(ans[i]+" ");
            }
            pw.println(ans[m-1]);
        }
        
        pw.close();
        input.close();
    }
}
