object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N = sc.nextInt()
  val hashMap = new scala.collection.mutable.HashMap[String, Int]()
  1.to(N).foreach { _ =>
    val word = sc.next()
    val count = hashMap.getOrElse(word, 0)
    hashMap.update(word, count + 1)
  }
  val keys = Seq("AC", "WA", "TLE", "RE")
  keys.foreach { key =>
    val count = hashMap.getOrElse(key, 0)
    println(s"$key x $count")
  }
}
