program main
  implicit none
  integer i,N, c1,c2,c3,c4
  character(3) S
  read(*, *)N
  c1 = 0
  c2 = 0
  c3 = 0
  c4 = 0
  do i = 1,N
    read(*, *)S
    if (S == 'AC') then
      c1 = c1+1
    elseif (S == 'WA') then
      c2 = c2+1
    elseif (S == 'TLE') then
      c3 = c3+1
    elseif (S == 'RE') then
      c4 = c4+1
    endif
  enddo
    
  !read(*, *) (L(i), i = 1,N)
  print '("AC x ",i0)',c1
  print '("WA x ",i0)',c2
  print '("TLE x ",i0)',c3
  print '("RE x ",i0)',c4
end program main
