Balances

Given a sequence of triplets formed by two names xx and yy and a natural nn, that indicate that xx has paid nn euros to yy, print the final balance of each person, first sorted by name, and then sorted by balance.

Input

Input is a non empty sequence of triplets formed each one by two names and a natural. There are not two people with the same name.

Output

Your program must print the final balance of each person, first sorted by name, and then sorted by balance, separated by a line with twenty dashes. In the event of a tie in the balance, it must print first the smallest name.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:17:40.398Z

© Jutge.org, 2006–2026.
https://jutge.org