n = int(input())

j = list()
for _ in range(n):
    string = input()
    j.append(string)

ac = j.count("AC")
wa = j.count("WA")
tel = j.count("TEL")
re = j.count("RE")
print(f"AC x {ac}")
print(f"WA x {wa}")
print(f"TEL x {tel}")
print(f"RE x {re}")