> The problem setting of this problem is partially shared with Problem F.
In the year $2222$, CatCoder will hold the CatCoder Double Contest (abbreviated as C2C).
There are $N$ writers who have problem proposals. Each writer's problem proposals are classified into $3$ types by difficulty: Hard, Medium, Easy, and the $i$\-th writer has $A_i$, $B_i$, $C_i$ problem proposals of Hard, Medium, Easy, respectively.
Each C2C simultaneously holds $2$ divisions, Div.1 and Div.2. The problem proposals required for each division are as follows:
* Div.1: One Hard and one Medium problem proposal from the same writer
* Div.2: One Medium and one Easy problem proposal from the same writer
Note that **the writers for Div.1 and Div.2 do not necessarily have to be the same**. Also, each problem proposal can be used in at most one division of one C2C.
Find the maximum number of times C2C can be held.
$T$ test cases are given, so find the answer for each.
## Constraints
* $1 \le T \le 10^5$
* $1 \le N \le 2 \times 10^5$
* $1 \le A_i,B_i,C_i \le 10^9$
* The sum of $N$ over all test cases is at most $2 \times 10^5$.
* All input values are integers.
## Input
The input is given from Standard Input in the following format:
$T$
$\text{case}_1$
$\text{case}_2$
$\vdots$
$\text{case}_T$
Each test case is given in the following format:
$N$
$A_1$ $B_1$ $C_1$
$A_2$ $B_2$ $C_2$
$\vdots$
$A_N$ $B_N$ $C_N$
[samples]