The Unknown Trading Company has installed a new inventory-tracking system that stores a complete database of goods and trading points worldwide. Each salespoint and each item is assigned a unique integer identifier (id). For every sale, the system logs the id of the item, the number of items sold, and the id of the salespoint.
Output a summary report that tabulates total sales by item and by salespoint. The report is a two-dimensional table that follows these rules:
The first line contains the number of records N. Each of the next N lines contains three integers qi si vi, where qi is the item id, si is the salespoint id, and vi is the number of items sold.
Print the table described above, one row per line, with the values in each row separated by single spaces.