Problem

8 /9


Online store

Problem

Given a database of sales of some online store. Each line of the input file is a record of the form:
Buyer item quantity,
where Buyer— buyer's name (string without spaces), product — product name (string without spaces), quantity — number of items purchased.
 
Create a list of all customers, and for each customer, count the number of units of each item they purchased.
 
 
Input
The first line of the input file contains the number N (\(1<=N<=100000\)) —number of records contained in this database data. Purchase details are entered in the specified format.
 
Imprint 
Print a list of all customers in lexicographical order, after the name of each customer print a colon, then list the names of all goods purchased by this customer in lexicographic order, after the name of each item print the number of units of goods purchased by this customer. Information about each product is displayed in a separate line.
 
 
Example
# Input Output
1
6
Ivanov paper 10
Petrov pens 5
Ivanov marker 3
Ivanov paper 7
Petrov envelope 20
Ivanov envelope 5
Ivanov:
envelope 5
marker 3
paper 17
Petrov:
envelope 20
pens 5