Osama Ismail directs a regional programming contest. Nobody may compete in it more than 5 times. A contestant who already competed in 5 different years would reach 6 by entering again, so that contestant is out.
You are given a list of participation records. Each record says that one contestant competed in one year. A contestant is eligible for the next contest when the number of distinct years in that contestant's records is 4 or fewer.
Print every eligible contestant.
The first line contains the number of test cases T.
The first line of each test case contains the number of records N. Each of the next N lines has the form "Name Year" and means that contestant Name competed in the regional contest in year Year. A name can contain spaces, so the last token of the line is the year and everything before it is the name.
The data comes from several sources, so the same record can appear more than once. Repeated copies of the same "Name Year" pair count as one participation.
For each test case, first print the line "Case #x:", where x is the test case number starting at 1. Then print the name of every eligible contestant, one per line, in lexicographic order. Names are compared by character code, so a space comes before every lowercase letter.
Do not print a blank line between test cases. When a test case has no eligible contestant, the "Case #x:" line is its whole output.