Fredo and his friends regularly visit their college canteen. As with any group, on a day , one of the friends pays the canteen bill of all the friends. You are given a table of logs which shows the entries of transactions between friends. The table consists of three fields as described below:
1. P1: Name of the person who pays the bill.
2. P2: Name of the person whose bill is paid by P1.
3. amount: Amount paid by P1 for P2.
You have to summarise the transaction between all pairs of friends. See the sample input and output for explanation.
Table : logs
Sample logs Table:
Here Fredo lends John 59+17=76 and John lends Fredo 27. So, in all John owes Fredo 49 units.
Similarly, Fredo lends Zeus 81+27=108 and Zeus lends Fredo 81. So, in all Zeus owes Fredo 17 units.
Similarly, Zeus owes John 67 units.
Only direct transactions are to be covered in the output table.
Only those entries should come in the output table which have NetAmount greater than 0.
The output table should be ordered by P1 in ascending order and then by P2 in ascending order.
It is guaranteed that the input table will contain all ordered pairs of friends atleast once.