ClosedCup
Penguin Bag Rockhead is once again imagining a conspiracy. This time, he is suspicious of the activities of commando penguins in the ClosedCup competitive programming contest. With a large number of teams participating, Bag suspects they could all be part of a conspiracy.
To investigate, Bag needs to organize the scattered data about the ClosedCup participants. He has a list of teams that have participated in the competitions. Each team is identified by a name and a list of participants. In this list, a team may appear multiple times, or different participants might be associated with the same team name.
Help Bag Rockhead compile a comprehensive list of participants for each team name over time. To do this, output the list of team names in lexicographical order. A string x is considered lexicographically smaller than a string y if either x is a prefix of y (and x ≤ y), or there exists an i (1 ≤ i ≤ min(|x|, |y|)) such that x_i < y_i, and for any j (1 ≤ j < i) x_j = y_j. Here, |a| denotes the length of string a. Lexicographical string comparison uses the < operator in modern programming languages. For each team name, list the participants who have competed for that team at least once. Participants should be listed in descending order of the number of participations. If the number of participations is the same, list them in lexicographical order.
Input
The first line of the input file contains a single number N (1 ≤ N ≤ 100000) - the number of team records. The next N lines contain the team data. Each record consists of a team name followed by a list of participants. The team name consists of characters with codes from 32 to 126, excluding 58 (':'
). The name is non-empty and its length does not exceed 20 characters. After the team name, there is a colon, a space, and a list of participants. Each participant is defined either by a first name and last name (two non-empty words) or a nickname (one non-empty word). Each word in the participant information consists only of lowercase or uppercase Latin letters. The first name and last name are separated by a single space. The list of participants consists of one, two, or three names. All participant names are distinct. After each participant, except the last one, there is a comma and a space. After the last name, there is a period and a newline character. The length of the information about one participant does not exceed 20 characters (including the space between the first name and last name).
The size of the input file does not exceed one megabyte. The input file always ends with an empty line.
Output
In the output file, print M team descriptions, separated by an empty line. Each description should consist of the team name, a colon, and a list of participants who have participated at least once in the team with that name. Print the information about each participant on a new line. First, print four spaces, then the first name and last name separated by a space or the participant's nickname, followed by a comma, a space, and the number of times this participant competed for this team. End with a period and immediately a newline character. List participants in descending order of the number of participations, and in lexicographical order if the number of participations is equal.
Print team descriptions in lexicographical order relative to the team names. There should be no extra empty lines in the output file.