시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB665100.000%

문제

There is a 4-dimensional array X, each index of which is in interval from 1 to N. Your task is to construct new 4-dimensional array Y , elements of which can be calculated using the next formula: Y [i1, i2, i3, i4] = min(X[j1, j2, j3, j4]), where 1 ≤ ik ≤ N − M + 1, ik ≤ jk ≤ ik + M − 1, and M is given.

입력

First line of the input file contains N and M (1 ≤ M ≤ N). Next lines of the input file contain elements of array X. The number of elements will be not more than 1500000 and elements will be integers not exceeding 109 by absolute value. They are given in such order, that the array can be read using following pseudocode:

for i = 1 to N:
    for j = 1 to N:
        for k = 1 to N:
            for l = 1 to N:
                read X[i, j, k, l]

출력

Output array Y in the same format as the X was given.

예제 입력 1

1 1
1

예제 출력 1

1

예제 입력 2

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

예제 출력 2

-5 -5 -4 -3 -5 -5 -4 -5 -5 -5 -5 -5 -4 -5 -4 -5