Cube Painting#89

Cube Painting

1 second
128 megabytes
Very easy
prb89

Sara received a Lego-like game called Unbounded Imaginations (UI) as a birthday gift. This game consists of many identical cubes, each with a face area of cm^2. The unique feature of UI is that you can connect two cubes face-to-face using special glue, as long as the faces match perfectly. Sara's older brother Darius decided to give her a puzzle: he constructed a three-dimensional object out of several cubes and asked Sara to paint every face that does not touch another cube. A face is considered open (unattached) if it is not joined to the face of another cube. For example, see the figure above.

In the example, the total number of open (unattached) faces is . Your task is to find the total area that Sara needs to paint.

Input

The first line contains — the number of test cases.

For each test case, the first line contains (1 \leq n \leq 200) — the number of cubes. The cubes are numbered from to .

The next lines describe the structure of the object. Each line corresponds to one cube. The line starts with an integer (the number of the cube), followed by a colon ":" and a space, then a list of (at most six) integers — the numbers of cubes connected to , and ending with a single "0" to indicate the end of the list.

It is guaranteed that each test case describes a valid object in space. You may construct any complex shape, including several separate objects, from the cubes.

Output

For each test case, output a single integer — the total number of open (unattached) faces for all cubes in that test case.

Examples

Example 1

Loading
Loading