The HTML version of the statement is not available.
About statements
The official statement of a problem is always the one
in the PDF document. The HTML version of the statement
is also given to help you, but may contain some content
that is not well displayed. In case of doubt, always use the PDF.
Public test cases
Input
4
Mary John 2000
John James 3000
Anna Mary 1000
James Anna 300
Output
John receives 1000
Mary receives 1000
Anna receives 700
James pays 2700
Input
4
Mary John 2000
John James 3000
Anna Mary 1000
James Anna 300
Output
John receives 1000
Mary receives 1000
Anna receives 700
James pays 2700