team_A = ["A-1","A-2", "A-3", "A-4", "A-5", "A-6", "A-7", "A-8", "A-9", "A-10", "A-11"]
team_B = ["B-1","B-2", "B-3", "B-4", "B-5", "B-6", "B-7", "B-8", "B-9", "B-10", "B-11"]

input_line = input()
cards_list = input_line.split(" ")
for i in range(len(cards_list)):
    element = cards_list[i]
    for j in range(len(team_A)-1,-1,-1):
        if element == team_A[j]:
            team_A.remove(element)
    for k in range(len(team_B)-1,-1,-1):    
        if element == team_B[k]:
            team_B.remove(element)
    if len(team_A) < 7 or len(team_B) < 7:
        break
        
print(f"Team A - {len(team_A)}; Team B - {len(team_B)}")
if len(team_A) < 7 or len(team_B) < 7:
    print("Game was terminated")
