Sebastián and Sebastian are playing a game.
The game consists of counting the number of materials and submaterials delivered to their factory while unloading a truck. The winner of the game will be the one who remembers most accurately how many materials and submaterials were received. The deal is that the loser has to take the winner out to dinner. Since neither of them wants to lose, both decide to cheat and secretly take notes to ensure their victory.
Each delivery is represented by three integers: the product, the material, and a corresponding submaterial. The full list contains N lines, each one representing a single delivery. But something went wrong. Due to a technical failure, the factory's official system lost all delivery records. Now, the only source of truth is the list that both Sebastián's created even if it contains repeated entries. They need your help to analyze their combined notes and generate a clean summary.
First line contains one integer $$$n$$$ ($$$1$$$ $$$\le$$$ $$$n$$$ $$$\le$$$ $$$10^6$$$), indicating the size of the combined list of Sebastián and Sebastian. Then n lines contains three integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$1$$$ $$$\le$$$ $$$a$$$, $$$b$$$, $$$c$$$ $$$\le$$$ $$$10^{18}$$$), the product id, material and sub material received.
For each product, print one line with three integers $$$A$$$, $$$B$$$, and $$$C$$$, where $$$A$$$ is the product id, $$$B$$$ is the number of distinct materials associated with that product, and $$$C$$$ is the number of distinct submaterials associated with that product. The products must be printed in increasing order.
101 1 12 2 13 4 12 2 22 2 11 3 121 1 21 4 11 4 21 4 3
1 3 6 2 1 2 3 1 1
3186 312 851372492291 103 93522568757 156 500988176
186 1 1 291 1 1 757 1 1