program main
    implicit none
    integer n,i
    integer :: s(4)=(/0,0,0,0/)
    character(3) c
    read(*,*)n
    do i=1,n
        read(*,*)c
        if(c=="AC ")then
            s(1)=s(1)+1
        else if(c=="WA ")then
            s(2)=s(2)+1
        else if(c=="TLE") then
            s(3)=s(3)+1
        else 
            s(4)=s(4)+1
        endif
    enddo
    write(*,*)"AC x ",s(1)
    write(*,*)"WA x ",s(2)
    write(*,*)"TLE x ",s(3)
    write(*,*)"RE x ",s(4)

end program main