Hektor lives in a single-family house in an estate of similar houses laid out on a regular grid of W×K houses, split into W rows and K columns. Each house occupies one 1×1 cell, and its position is a pair of numbers: the row index and the column index of that cell.
A year ago the estate ran a contest for the best-trimmed lawn, and the judges gave every house a score. This year the contest returns. The residents love to compete and hate being outdone by their neighbors at anything, so Hektor expects every house to aim for a score at least as high as the best score anywhere in its neighborhood last year. The neighborhood of the house at (w,k) is every house at (a,b) with ∣a−w∣≤R and ∣b−k∣≤R; it therefore forms a square of side 2R+1 centered at (w,k) (near the borders only the cells that actually exist inside the estate count).
Given the score of every house, compute for each house the highest score in its neighborhood.
The first line contains a natural number Z (1≤Z≤10): the number of test sets. The test sets follow one after another.
The first line of each test set contains three space-separated natural numbers W, K, R (1≤W,K,R≤1000): the number of rows, the number of columns, and the neighborhood radius.
Each of the next W lines describes one row of the estate, from the first row to the W-th. Such a line holds K space-separated natural numbers gi (1≤gi≤1000000): the scores of that row's houses, from the first column to the K-th.
For each test set, print W lines with K space-separated numbers each: the highest neighborhood score for every house, in the same order as the input.