The first line contains one integer $T(1\le T\le 2500)$, the number of test cases.
For each test case, the first line contains $3$ integers $n,m,k(3\le n,m\le 10^9,1\le k\le 10^4,\sum k\le 6\times 10^4)$, where $m$ is guaranteed to be an odd number.
Each of the next $k$ lines contains $3$ integers $r_i,c_i,t_i(1\le r_i\le n,1\le c_i\le m,c_i\ne\frac{m+1}{2},1\le t_i\le 10^9)$, the position of $i$th bottle of milk and the time it takes Tom to drink.