program Main
    integer(8) n
    integer(8) :: i= 0
    integer(8) :: c0 = 0
    integer(8) :: c1 = 0
    integer(8) :: c2 = 0
    integer(8) :: c3 = 0
    character(3) str
    read *, n
    do
        if(i == n)exit
        read *, str
        if(str .eq. "AC")then
            c0 = c0 + 1
        else if(str .eq. "WA")then
            c1 = c1 + 1
        else if(str .eq. "TLE")then
            c2 = c2 + 1
        else if(str .eq. "RE")then
            c3 = c3 + 1
        end if
        i = i + 1
    end do
    print "('AC x ',i0)", c0
    print "('WA x ',i0)", c1
    print "('TLE x ',i0)", c2
    print "('RE x ',i0)", c3
end program