fun main() {
//    a()
    b()
}

fun a() {
    val n = readLine()!!.toInt()
    if (n % 1000 == 0) println(0) else println("${1000 - n % 1000}")
}

fun b() {
    val n = readLine()!!.toInt()
    val result = mutableListOf<Int>(0, 0, 0, 0)
    for (i in 0 until n) {
        when (readLine()!!) {
            "AC" -> result[0]++
            "WA" -> result[1]++
            "TLE" -> result[2]++
            else -> result[3]++
        }
    }
    println("AC x ${result[0]}")
    println("WA x ${result[1]}")
    println("TLE x ${result[2]}")
    println("RE x ${result[3]}")
}