内存限制：357 MiB 时间限制：100 Sec

The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line.
Each test case looks as follows: The first line contains three positive integer N, M and K giving the number of different properties of the cards, the number of different values of a single property, and the number of cards drawn.
Each of the next K lines describes one of these cards. The i-th of these lines (1 ≤ i ≤ K) contains exactly N numbers pi,j (1 ≤ j ≤ N), 1 ≤ pi,j ≤ M. Value pi,j is the value of the j-th property of the i-the card.

```
1
```

4 3 12

1 1 1 2

2 3 3 3

2 2 3 1

1 3 1 3

3 3 3 3

1 2 1 1

2 1 3 2

1 1 3 2

2 3 2 3

1 3 2 3

3 2 1 1

3 1 2 2

```
11
```