Jobs is a stock clerk who has worked at a computer-manufacturing company since it was founded. He is responsible for every transaction in the stockroom where computer parts are stored. Jobs is old-fashioned: he still records every transaction by hand in his booklet and has always resisted computerizing the records. That changed today, when his boss asked him for a summary report on the current state of the stockroom — the computers currently handed out to employees, and the working and non-working parts still in the stockroom. The report is due tonight and he has no time to compile it by hand from all the transactions in his booklet, so he asks you to write a program that reads all transactions and produces the report.
Each transaction in the booklet begins with a date-time, followed by one of these templates:
Bought <NUM> <PIECE>.Assembled a computer for <PERSON> using <PIECES>.Got the computer of <PERSON> back and disassembled it.Found that <A> <PIECE> is not working.<A> <PIECE> is repaired and now can be used again.The placeholders above are defined as follows (the first letter is capitalized when the placeholder starts a sentence):
<A>: either "a" or "an", depending on the word that follows.<NUM>: either <A> (meaning 1), or "K items of", where K is an integer greater than 1.<PERSON>: the full name of an employee — one or more space-separated words, each starting with a capital letter.<PIECES>: a list of <NUM> <PIECE> entries separated by commas. The list always has at least 2 entries, and an extra "and" is placed after the last comma (before the final entry).<PIECE>: a phrase naming a computer part (such as RAM or CPU), possibly with extra details describing the model, speed, capacity, etc.You may assume that each entity (a part type or an employee) is always referred to by a single, unique, case-sensitive phrase, and that no two different entities share the same phrase, even when compared case-insensitively. Every part that is bought is working when bought; only working parts are used to assemble a computer. Each employee owns at most one computer at any time, and every transaction is logically valid at the moment it is written.
The input contains several test cases. Each test case begins with a line containing the integer $n$ ($1 \le n \le 500$), the number of transactions, followed by $n$ transactions.
Each transaction begins with a date-time in the format "year-month-day hour", where year, month, day, and hour lie in the ranges $[2000, 2012]$, $[1, 12]$, $[1, 31]$, and $[0, 23]$ respectively; values below 10 may be padded with a leading "0". The date-times within a single test case are all distinct, and the transactions are not necessarily listed in chronological order — you must process them in increasing order of their date-times. The date-time is separated from the transaction sentence by the string " - " (space, hyphen, space).
Every number appearing in <NUM> is less than $10^5$. Consecutive words are separated by a single space. Employee names and part-type phrases are wrapped in double quotation marks, and every character inside the quotation marks is alphanumeric.
The input terminates with a line containing a single "0", which is not a test case.
For each test case, output several lines.
First, output the number of employees who currently own a computer, $X$, using the following format:
There are X employees who currently have a computer:There is one employee who currently has a computer:No computer is currently given out to the employees.Then, if $X > 0$, print $X$ lines, each containing the full name of one such employee. These lines must be sorted in lexicographic order.
Next, print one line for every part type that appears in the booklet — exactly one line per type — sorted in lexicographic order of the part phrases. For a part phrase <PIECE>, its line must be one of:
There is no "<PIECE>" left in the stockroom.There is one "<PIECE>" left in the stockroom which is working.There is one "<PIECE>" left in the stockroom which is not working.There are X items of "<PIECE>" left in the stockroom, all working.There are X items of "<PIECE>" left in the stockroom, all not working.There are X items of "<PIECE>" left in the stockroom, Y working and Z not working.Print a line containing "###" between every two consecutive test cases.
When comparing two multi-word phrases, compare their first words; if those are equal, compare the second words, and so on. If every word of the shorter phrase matches the corresponding word of the longer phrase, the shorter phrase comes first. When comparing two words character by character, digits rank before letters, and letters are compared case-insensitively. Thus "A AB" < "A10" < "A2" < "aa" = "AA" < "AA B".
Note: only parts physically in the stockroom count as "left in the stockroom"; parts inside a currently-assembled computer are not counted. When a computer is disassembled, all of its parts return to the stockroom as working. A "Found that ... is not working" transaction turns one working stockroom item of that part into a non-working one, and a "... is repaired ..." transaction turns one non-working stockroom item back into a working one.