let N = Int(readLine()!)!

enum Status: String, CaseIterable {
    case ac = "AC"
    case wa = "WA"
    case tle = "TLE"
    case re = "RE"
}

var results = [Status: Int]()
Status.allCases.forEach {
    results[$0] = 0
}

for _ in stride(from: 0, to: N, by: 1) {
    let S = readLine()!
    results[Status(rawValue: S)!]! += 1
}

Status.allCases.forEach {
    print("\($0.rawValue) x \(results[$0]!)")
}
