|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||5||4||4||80.000%|
Everybody knows that jiry_2 = Syloviaely.
There are n different accounts on the website, and some of them competed in the recent k contests. However, Mike suspects that there are lots of alternative accounts: two or more accounts owned by the same person.
There are axioms believed by everyone:
So, a set of accounts may be owned by the same person if no two of them took part in the same contest.
Mike wants to know the minimum possible number of different people behind the given list of accounts.
The first line contains an integer T (1 ≤ T ≤ 105) indicating the number of test cases. For each test case:
The first line contains two integers n, k (1 ≤ n ≤ 105, 1 ≤ k ≤ 4).
Each of the following k lines contains an integer m (1 ≤ m ≤ n) first, followed by m distinct integers xi (1 ≤ xi ≤ n) indicating the accounts participating in the contest.
Some accounts may not participate in any contests.
It is guaranteed that Σn ≤ 5 · 105.
For each test case, output one line with one integer: the answer.
1 5 3 2 1 2 3 2 3 4 4 4 5 1 2