Who Is the Winner?

No attempts yetTime limit1sMemory limit128 MB

Problem

When a contest ends, most contestants are left frustrated, wondering where things went wrong.

The judges are frustrated too: they still have to score every contestant from the submission log and work out the final standings.

The contest is over, but if you still have some coding energy left, let's build a program that computes the ranking for the judges.

Input

The first line contains the number of test cases $K$.

The first line of each test case contains three integers $M$, $N$, $P$.

  • $M$ is the number of problems used in the contest ($1 \le M \le 10$).
  • $N$ is the total number of submissions ($1 \le N \le 5000$).
  • $P$ is the number of contestants ($1 \le P \le 500$).

The problems are named $A$, $B$, $\dots$ in order, and contestants are numbered from $1$ to $P$.

The next $N$ lines each contain one submission in the format p m t j, where $p$ is the contestant's number, $m$ is the problem name ($A$, $B$, $\dots$), $t$ is the submission time, and $j$ is the verdict: $j = 0$ means wrong answer and $j = 1$ means accepted.

The submissions are given in non-decreasing order of submission time.

The first time a contestant solves a problem, (the accepted time) $+$ (the number of wrong attempts on that problem before it was accepted) $\times 20$ is added to that contestant's total score. Only the first accepted submission for a problem counts; every submission after solving that problem is ignored. A problem that is never solved contributes nothing to the score.

Output

For each test case, first print Data Set K: (where $K$ is the test-case number).

Then print the $P$ contestants from the highest rank to the lowest, one per line, each line showing the contestant number, the number of solved problems, and the total score, separated by spaces.

The ranking rules are:

  • A contestant who solved more problems ranks higher.
  • Among contestants who solved the same number of problems, the one with the lower total score ranks higher.

No two contestants are ever fully tied in any test case.

Print one blank line between consecutive test cases.