program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: cnt(4)=0
    integer(int32):: i,n
    character(3):: judge


    read*, n
    do i=1,n
        read*, judge
        if (judge(1:1) == 'A') then
            cnt(1)=cnt(1)+1
        else if (judge(1:1) == 'W') then
            cnt(2)=cnt(2)+1
        else if (judge(1:1) == 'T') then
            cnt(3)=cnt(3)+1
        else
            cnt(4)=cnt(4)+1
        end if
    end do
    
    print'("AC x ",i0)', cnt(1)
    print'("WA x ",i0)', cnt(2)
    print'("TLE x ",i0)', cnt(3)
    print'("RE x ",i0)', cnt(4)
end program main