import sys
import operator
totals = {}

def score(shots , n , hole):
    hole_score = shots - hole
    if hole_score in range(-4 , 2):
        totals[n] += hole_score * (-1) + 2

def main():
    a = [l.strip().split() for l in sys.stdin]
    par = a[0]
    index = a[1]
    for line in a[2:]:
        name = " ".join(line[:-19])
        handicap = int(line[-19])
        strokes = line[-18:]
        totals[name] = 0
        for idx , shots in enumerate(strokes):
            try:
                shots = int(shots)
                p = int(index[idx])
                hpar = int(par[idx])
                if handicap > 36 and handicap <= 54 and p <= handicap - 36:
                    net = shots - 3
                elif (handicap > 18 and handicap <= 36 and p <= handicap - 18) or (handicap > 36 and handicap <= 54 and p > handicap - 36):
                    net = shots - 2
                elif (handicap >= 1 and handicap <= 18 and p <= handicap) or (handicap > 18 and handicap <= 36 and p > handicap - 18):
                    net = shots - 1
                else:
                    net = shots
                score(net , name , hpar)
            except:
                pass
    final = sorted(totals.items() , key = operator.itemgetter(1) , reverse = True)
    for num in final:
        print("{:>{}} : {:2}".format(num[0] , len(max(totals.keys() , key = len)) , num[1]))

if __name__ == "__main__":
    main()
