Typical problem

Input: First row total teams played
next names of teams(string)
then number of matches played
then score of each match
Output: after every match score of individual team gets added up and winner teams gets score of 2.
show output in given form

input:

4
a
b
c
d
a 1.0 b 2.0
b 1.0 c 2.1
d 2.5 a 1.2
b 1.5 d 1.0
c 1.2 a 2.0
output:
b 4 4.50
a 2 4.20
d 2 3.50
c 2 3.30