Stock Exchange

No attempts yetTime limit1sMemory limit128 MB

Problem

Stock exchanges around the world have been hit hard by the financial crisis. To protect their profits, they want to cut costs by automating their operations with new software.

Your task is to detect every pair of a buyer and a seller who are able to make a deal with each other.

Input

The input describes several issuers (stocks). Each issuer starts with a line containing an integer $N$, a single space, and the issuer's code. The next $N$ lines each describe one bid.

A bid consists of an agent's name, a single space, the bid type in lowercase letters (either buy or sell), another single space, and a price given as a decimal number with exactly three digits after the decimal point. A buy bid gives the maximum price the agent is willing to pay; a sell bid gives the minimum price for which the agent is willing to sell.

  • Each issuer code consists of 1 to 10 uppercase letters (AZ).
  • Each agent name has 1 to 20 characters and may contain both lowercase and uppercase letters.
  • Within a single issuer all agent names are distinct, but the same agent may post bids for different issuers.
  • $1 \le N \le 1000$.
  • No price is higher than $10000$.

The input ends with a line containing the string 0 END.

Output

For each issuer, print its code on its own line. Then, for every bid of that issuer (in the same order as the input), print the agent's name, a colon (:), a single space, and the list of all agents who are potential counter-parties for that agent — one of the two wants to buy and the other wants to sell, and the sell price is less than or equal to the buy price.

Print the counter-party names separated by a single space, in the same order they appear in the input for that issuer. If there is no matching bid, print NO-ONE instead.