Candy Bombers

Assign each pilot to at most one plane they can fly to maximize the number of planes sent.

Medium4GraphDFSNo attempts yetTime limit1sMemory limit256 MB

Problem

When Germany was split into a part controlled by the Allies (France, England, the USA) and a part controlled by the Soviet Union, Berlin was divided as well. West Berlin belonged to West Germany, but the whole of Berlin sat inside East German territory, so no land route connected West Berlin to the rest of West Germany. After West Germany introduced a new currency, the Soviet Union cut every land and water connection from West Germany to West Berlin from 1948 to 1949. The Allies flew supplies from West Germany into West Berlin instead, and that operation is called the Air Bridge. Gail Halvorsen is credited with starting the practice: to entertain the children waiting for the planes, pilots dropped chocolate and other candy on small homemade parachutes. The planes became known as candy bombers.

Running an Air Bridge means solving several optimization problems. One of them is how to assign the planes and pilots you have so that as much weight as possible reaches the destination. Assume every plane carries the same amount of cargo. The goal is then to fly as many planes as you can.

You are given the list of planes and pilots currently available, and for each pilot the list of planes that pilot is able to fly. A pilot flies at most one plane, and a plane is flown by at most one pilot. Compute the largest number of planes that can be sent.

Input

The first line contains the number of data sets KK, with K1K \ge 1. Then KK data sets follow in the format below.

The first line of a data set contains two integers mm and nn. Here mm is the number of available planes, nn is the number of pilots, and 0m,n2000 \le m, n \le 200. Then follow nn lines, one per pilot. The first number on line ii is the number mim_i of planes that pilot ii is capable of flying, with 0mim0 \le m_i \le m. It is followed by mim_i integers, each between 11 and mm and all distinct, which are the planes pilot ii can fly.

Output

For each data set, first print Data Set x: on a line of its own, where x is the number of the data set, counting from 1. On the next line print the largest number of planes you can send. Print one blank line after the output of each data set.