import io.StdIn.{readInt, readLine}
object Main extends App {
  val n = readInt
  val ss = for (_ <- 1 to n) yield readLine

  def rec(s_list: List[String], c0: Int, c1: Int, c2: Int, c3: Int): List[Int] = s_list match {
    case Nil  => List(c0, c1, c2, c3)
    case list => list.head match {
      case "AC" => rec(list.tail, c0+1, c1, c2, c3)
      case "WA" => rec(list.tail, c0, c1+1, c2, c3)
      case "TLE" => rec(list.tail, c0, c1, c2+1, c3)
      case "RE" => rec(list.tail, c0, c1, c2, c3+1)
    }
  }
  val result = rec(ss.toList, 0, 0, 0, 0)
  println(s"AC x ${result(0)}")
  println(s"WA x ${result(1)}")
  println(s"TLE x ${result(2)}")
  println(s"RE x ${result(3)}")
}