There is an area map that is a rectangular matrix *n* × *m*, each cell of the matrix contains the average height of a corresponding area part. Peter works for a company that has to build several cities within this area, each of the cities will occupy a rectangle *a* × *b* cells on the map. To start construction works in a particular place Peter needs to remove excess ground from the construction site where a new city will be built. To do so he chooses a cell of the minimum height within this site, and removes excess ground from other cells of the site down to this minimum level. Let's consider that to lower the ground level from *h*<sub class="lower-index">2</sub> to *h*<sub class="lower-index">1</sub> (*h*<sub class="lower-index">1</sub> ≤ *h*<sub class="lower-index">2</sub>) they need to remove *h*<sub class="lower-index">2</sub> - *h*<sub class="lower-index">1</sub> ground units.

Let's call a site's position optimal, if the amount of the ground removed from this site is minimal compared to other possible positions. Peter constructs cities according to the following algorithm: from all the optimum site's positions he chooses the uppermost one. If this position is not unique, he chooses the leftmost one. Then he builds a city on this site. Peter repeats this process untill he can build at least one more city. For sure, he cannot carry out construction works on the occupied cells. Would you, please, help Peter place cities according to the algorithm?
The first line contains four space-separated integers: map sizes *n*, *m* and city sizes *a*, *b* (1 ≤ *a* ≤ *n* ≤ 1000, 1 ≤ *b* ≤ *m* ≤ 1000). Then there follow *n* lines, each contains *m* non-negative space-separated numbers, describing the height matrix. Each number doesn't exceed 10<sup class="upper-index">9</sup>.
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def make_array(dims, fill):
    if len(dims) == 1:
        return [fill]*dims[0]
    nxt = dims[1:]
    ret = [make_array(nxt,fill) for i in range(dims[0])]
    return ret

class Sparse_Table_2D():
    def __init__(self,n,m,F=min):
        self.n = n
        self.m = m
        self.ln = (n-1).bit_length()+1
        self.lm = (m-1).bit_length()+1
        self.data = make_array((self.ln,n,self.lm,m), 0)
        self.F = F

    def construct(self, matrix):
        for i in range(self.n):
            for j in range(self.m):
                self.data[0][i][0][j] = matrix[i][j]
            for jc in range(1, self.lm):
                for ic in range(self.m):
                    self.data[0][i][jc][ic] = self.F(self.data[0][i][jc-1][ic], self.data[0][i][jc-1][min(ic+(1<<(jc-1)), self.m-1)])
        for jr in range(1,self.ln):
            for ir in range(self.n):
                for jc in range(self.lm):
                    for ic in range(self.m):
                        self.data[jr][ir][jc][ic] = self.F(self.data[jr-1][ir][jc][ic], self.data[jr-1][min(ir+(1<<(jr-1)), self.n-1)][jc][ic])

    def get(self, x1,y1,x2,y2):
        x = x2-x1
        lx = x.bit_length()-1
        y = y2-y1
        ly = y.bit_length()-1

        R1 = self.F(self.data[lx][x1][ly][y1], self.data[lx][x1][ly][y2-(1<<ly)])
        R2 = self.F(self.data[lx][x2-(1<<lx)][ly][y1], self.data[lx][x2-(1<<lx)][ly][y2-(1<<ly)])
        R = self.F(R1, R2)
        return R

n,m,a,b = map(int, input().split())
grid = [list(map(int, input().split())) for i in range(n)]

s = [[0]*(m+1) for i in range(n+1)]
for i in range(n):
    for j in range(m):
        s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + grid[i][j]

def get(x1,y1,x2,y2):
    return s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1]

sparse = Sparse_Table_2D(n,m,min)
sparse.construct(grid)

pos = []
for i in range(n-a+1):
    for j in range(m-b+1):
        tmp = get(i,j,i+a,j+b) - a*b*sparse.get(i,j,i+a,j+b)
        pos.append([tmp, (i,j)])
pos.sort()
used = [[0]*m for i in range(n)]
ans = []

def check(i,j):
    for x in range(a):
        for y in range(b):
            if used[i+x][j+y]:
                return False
    return True
def write(i,j):
    for x in range(a):
        for y in range(b):
            used[i+x][j+y] = 1

for s, (i,j) in pos:
    if check(i,j):
        ans.append([i+1,j+1,s])
        write(i,j)
for l in ans:
    print(*l)
