import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toLong()
    var ac= 0
    var wa = 0
    var tle = 0
    var re = 0
    for(i in 1..kotlin)
    {
        var arr = scan.nextLine()
        if(arr=="AC")
            ac++
        if(arr=="WA")
            wa++
        if(arr=="TLE")
            tle++
        if(arr=="RE")
            re++
    }
    var map = HashMap<String,Int>()
    map.put("AC",ac)
    map.put("WA",wa)

    map.put("TLE",tle)
    map.put("RE",re)

    var z = map.toList()
            .sortedByDescending { (key, value) -> value }
            .toMap()

    for(q in z)
    {
        println("${q.key} x ${q.value}")
    }
}
