# This stores information about who is a friend of whom

def main():
    F = {} # keys are names; values are lists of friends of that person
    done = False
    while not done:
        str = input( "Enter person, friend, or blank to exit: " )
        if str == "":
            done = True
        else:
            p, f = str.split( "," )
            if p in F.keys():
                F[p].append(f)
            else:
                F[p] = [f]
    for person in F.keys():
        print( person,  end = ": " )
        for friend in F[person]:
            print( friend, end = " " )
        print()

main()
