Input contains number of records N, followed by N triplets of integers qi si vi, where qi -- item id, si -- salespoint id, vi -- number of items sold.
1 ≤ N ≤ 500000, 1 ≤ qi, si, vi ≤ 109, the summary table will have no more than 108 cells, the summary value in each cell will not exceed than 231−1.