Problem Description
Let's solve another interesting problem using collections module.
There are N customers who bought items, the list is represent as item id and price.
Your task is to print each item id and total price(quantity * price) in order of its first occurrence.
Problem Constraints
1 <= N <= 105
1 <= item id, price <= 109
Input Format
First line consist of integer N.
Each of the next N lines consist of two space separated integers item id and price of item.
Output Format
Print each item id and total price(quantity * price) in order of its first occurrence.
Note: There should be exactly one space after each integers you printed.
Example Input
Input 1:
9 10 10 2 5 10 10 2 5 1 2 1 2 10 10 4 5 2 5
Input 2:
4 1 2 1 2 2 2 1 2
Example Output
Output 1:
10 30 2 15 1 4 4 5
Output 2:
1 6 2 2
Example Explanation
Explanation 1:
Item with id 10 comes first, followed by 2, 1, 4. So, print the item in order of its first occurence.
Explanation 2:
Item with id 1 comes first, followed by 2.