The first line contains a number $t(1 \leq t \leq 1000)$, the number of the testcases. And there are no more than $3$ testcases with $n > 100$.
For each testcase, the first line contains three numbers $n,m,K(1 \leq n \leq 4 \times 10^4,1 \leq m \leq 4),1 \leq K \leq \lfloor \frac{nm}{2} \rfloor$.
Then $n-1$ lines follow, each line contains $m$ numbers $A_{i,j}(1 \leq A_{i,j}
\leq 10^9)$ -- the weight of the edge between $(i,j)$ and $(i+1,j)$.
If $m>1$, then $n$ lines follow, each line contains $m-1$ numbers $B_{i,j}(1 \leq B_{i,j} \leq 10^9)$ -- the weight of the edge between $(i,j)$ and $(i,j+1)$.