func main() {
    let N = Int(readLine()!)!
    let a = (0..<N).map { _ in readLine()! }
    
    let c0 = a.filter {$0 == "AC"}.count
    let c1 = a.filter {$0 == "WA"}.count
    let c2 = a.filter {$0 == "TLE"}.count
    let c3 = a.filter {$0 == "RE"}.count

    print("AC x ", c0)
    print("WA x ", c1)
    print("TLE x ", c2)
    print("RE x ", c3)
}

main()
