program probA
  implicit none
  character(len=3) :: s
  integer :: AC, WA, TLE, RE, i, n
  
  read(*,*) n

  AC = 0
  WA = 0
  TLE = 0
  RE = 0
  
  do i = 1, n
     read(*,*) s
     if ( s == 'AC' ) then
        AC = AC + 1
     else if ( s == 'WA' ) then
        WA = WA + 1
     else if ( s == 'TLE' ) then
        TLE = TLE + 1
     else
        RE = RE + 1
     end if
  end do

  write(*,'("AC x ", i0)') AC
  write(*,'("WA x ", i0)') WA
  write(*,'("TLE x ", i0)') TLE
  write(*,'("RE x ", i0)') RE
  
  stop
end program probA
