program ABC173B
    implicit none
    integer(8)::N,C(4),i
    character(3)::S
    read*,N
    C=0
    do i=1,N
        read*,S
        if(len_trim(S)==2)then
            if(S(1:2)=="AC")C(1)=C(1)+1
            if(S(1:2)=="WA")C(2)=C(2)+1
            if(S(1:2)=="RE")C(4)=C(4)+1
        else
            C(3)=C(3)+1
        end if
    end do
    print'(A,i0)',"AC x ",C(1)
    print'(A,i0)',"WA x ",C(2)
    print'(A,i0)',"TLE x ",C(3)
    print'(A,i0)',"RE x ",C(4)
end program ABC173B