At the first line there is a positive integer N stating the number of assignments to follow. Each assignment begins with three integer numbers X, Y, Z on a single line, separated by spaces. 1 <= X,Y,Z <= 100. All the flooded cubes are inside a box with the size X, Y, and Z meters. All cubes outside this box are filled with rock. After the first line, the description of Z layers follows, starting from the top one. Each layer begins with a line with a single integer number P that denotes the number of flooded cubes in that layer. Then P lines follow, each of them consisting of two integer numbers R and S, 1 <= R <= X, 1 <= S <= Y. These number are coordinates of one flooded cube, given in meters.