There is an old stone game played on an arbitrary general tree T. The goal is to place a single stone on the root of T while obeying the following rules:
The player wins if, by following these rules, a stone is successfully placed on the root of the tree.
Write a program that determines the least number of stones K the player must pick at the beginning so that the game on the given tree can be won.
The input describes several trees. The first line contains M, the number of trees (1≤M≤10). Descriptions of the M trees follow. Each tree has N<200 nodes labeled 1,2,…,N, and each node may have any number of children. The root is labeled 1. Each tree's description begins with N on its own line. The next N lines describe the children of every node in order of their labels; each line contains a node label p (1≤p≤N), the number r of immediate children of p, and then the labels of those r children.
For each input tree, print one line containing the minimum number of stones that must be picked in rule 1 in order to win the game on that tree.