fun main() {
    b()
}

fun a() {
    val N = readLong()
    val otsuri = (1000 - N%1000)%1000
    println("${otsuri}")
}

fun b() {
    val N = readLong().toInt()
    val map = mutableMapOf<String, Long>()
    repeat(N) {
        val s = readLine()!!
        map[s] = map.getOrDefault(readLine()!!, 0) + 1
    }
    listOf("AC", "WA", "TLE", "RE").forEach {
        println("$it x ${map.getOrDefault(it, 0)}")
    }
}

fun readLong() = readLine()!!.toLong()
fun readLongList() = readLine()!!.split(" ").map { it.toLong() }

fun Long.print() { println(this) }