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.