You have a 4-dimensional array X, each index of which can take values from 1 to N. You must construct a new 4-dimensional array Y , whose elements must take the following values: Y [i
1, i
2, i
3, i
4] = min(X[j
1, j
2, j
3, j
4]), where 1 ≤ i
k ≤ N .minus; M + 1, i
k ≤ j
k ≤ i
k + M − 1 and M - given number.
Input
The first line of the input file specifies N and M (1 ≤ M ≤ N). The remaining lines of the file contain the elements of the array X. The number of elements will not exceed 1500000 and they themselves will be integers not exceeding 10
9 in absolute value. They are in such order that you can read them using 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]
Imprint
Output the required array Y in the same format as the array X was given.
Examples
# |
Input |
Output |
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 |
-5 -5 -4 -3 -5 -5 -4 -5 -5 -5 -5 -5 -4 -5 -4 -5 |