import datetime
import string
import re
import math

aDic = {'ac': 0, 'wa': 0, 'tle': 0, 're': 0}

N = int(input())
for i in range(N):
    aDic[input()] += 1

for page in aDic:
    print(page + ' x ' + str(aDic[page]))
