def AddToList(L, name, club):
    for entry in L:
        if entry[0] == club:
            if name in entry:
                print "%s is already in club %s" % (name, club)
            else:
                entry.append(name)
            break
    else:
        L.append([club, name])

def PrintClub(c):
    print "%s" % c[0]
    for person in c[1:]:
        print "%5s %s" % ("", person)
        
def PrintList(L):
    for entry in L:
        PrintClub(entry)
    
def main():
    L = []

    AddToList(L, "john", "Beatles")
    AddToList(L, "george", "Beatles")
    AddToList(L, "paul", "Beatles")
    AddToList(L, "ringo", "Beatles")

    AddToList(L, "harry", "Hogwarts")
    AddToList(L, "hermione", "Hogwarts")
    AddToList(L, "ron", "Hogwarts" )
    AddToList(L, "hagrid", "Hogwarts" )
    
    done = False
    while not done:
        PrintList(L)
        name = raw_input("name, or blank to exit: " )
        if name == "":
            done = True
        else:
            club = raw_input("club to add to: " )
            AddToList(L, name, club)

main()
