Everyone knows that Kirisame Marisa(きりさめ·まりさ) often has affaires with other witches in TouHou.
For example, she has an affair with Reimu today and tomorrow is Flandre.
You have to make clear that how many witches she has affairs with.
This problem has several cases.
The first line of each case contains an integer N(0 < N <= 5000).
Then follows N lines. The ith has a name NAMEi and an integer Hi(0 < Hi < 20000), means at the ith day Marisa has an affair with NAMEi, and NAMEi increases Hi likability.
You can consider that every name only contains uppercase and lowercase letters, and not longer then 20;
For each case, you should output like that:
At the first line, you should output how many witches Marisa has affaires with;
Then each line output like that:
The name of the witch, the likability with that witch and the time(s) they have affaires. Order by likability descending.
If their likabilities are the same, then order by affair times descending.
If their likabilities and affair times are the same, then order by lexicographical order increasing.