Throw a Party!!!

No attempts yetTime limit1sMemory limit128 MB

Problem

After finishing a programming contest, Yeonjeong decided to throw a party. She invited her friends, and they spent a joyful day drinking soju and beer.

Now that the party is over, Yeonjeong wants to send all of her friends safely back to their own homes. The trouble is that the friends' homes are so far away that they must travel by car.

To use a car, the following conditions must be satisfied.

  • Every car heading to a given region must carry at least one person who is not drunk (because someone has to drive), and that car does not travel anywhere other than that region.
  • A car may leave seats empty, but it may never carry more people than its capacity.

You are given where each friend lives, the cars available to each region, and the number of regions. Determine how many friends are forced to sleep over at Yeonjeong's house because there are not enough seats, or because there is no car going to their region.

Input

The first line contains the number of test cases $K$ ($K \ge 1$).

Each test case then follows in this format.

The first line contains the number of friends $n$, the number of cars that can travel to other regions $c$, and the number of regions $\ell$, separated by spaces ($n \le 500$, $c \le n$, $\ell \le c$).

Each of the next $n$ lines contains the region number where a friend lives (from 1 to $\ell$) and a character indicating whether that friend is drunk (I) or not drunk (S).

Each of the following $c$ lines contains the region number a car travels to (from 1 to $\ell$) and the maximum number of seats in that car (between 2 and 8, inclusive).

Output

For each test case, print a line Data Set x: (where x is the test case number, starting from 1), followed on the next line by the number of friends who must sleep over at Yeonjeong's house.