import Foundation

struct Mojiretu: Equatable {
    var characters: [Int]
    
    init(characters: [Int]) {
        
        self.characters = characters
    }
    init(_ slice: ArraySlice<Int>) {
        
        self.characters = Array(slice)
    }
}

extension Mojiretu {
    struct KeyCode {
        static let space = 0x20
        static let lf = 0x0A
    }
    
    static func readLine() -> Mojiretu {
        .init(characters:
            (0...)
                .lazy
                .map { _ in Int(getchar()) }
                .prefix { $0 != KeyCode.lf }
        )
    }
    
    static func readToken() -> Mojiretu {
        .init(characters:
            (0...)
                .lazy
                .map { _ in Int(getchar()) }
                .prefix { $0 != KeyCode.lf && $0 != KeyCode.space }
        )
    }
    
    var tokens: [Mojiretu] {
        characters
            .split { $0 == KeyCode.lf || $0 == KeyCode.space }
            .map(Mojiretu.init)
    }
}

struct MojiretuCharacterIterator: IteratorProtocol {
    private var iter: IndexingIterator<Array<Int>>
    
    init(_ Mojiretu: Mojiretu) {
        iter = Mojiretu.characters.makeIterator()
    }
    
    mutating func next() -> Character? {
        guard let i = iter.next() else { return nil }
        
        return Unicode.Scalar(i).map(Character.init)
    }
}

extension Mojiretu: Sequence {
    
    func makeIterator() -> MojiretuCharacterIterator {
        MojiretuCharacterIterator(self)
    }
}


extension Mojiretu {
    var integer: Int {
        characters
            .lazy
            .map { $0 - Int("0".utf8.first!) }
            .prefix { (0...9) ~= $0 }
            .reduce(0) { r, i in r * 10 + i }
    }
    
    var string: String {
        .init(
            characters
                .compactMap(Unicode.Scalar.init)
                .map(Character.init)
        )
    }
}


extension Mojiretu {
    
    static func == (lhs: Mojiretu, rhs: String) -> Bool {
        lhs.string == rhs
    }
    
    static func == (lhs: String, rhs: Mojiretu) -> Bool {
        lhs == rhs.string
    }
    
    static func ~= (lhs: Mojiretu, rhs: String) -> Bool {
        lhs == rhs
    }
    
    static func ~= (lhs: String, rhs: Mojiretu) -> Bool {
        lhs == rhs
    }
}


let n = Mojiretu.readLine().integer

let judge = (1...n)
  .map { _ in Mojiretu.readLine() }
  .reduce((0, 0, 0, 0)) { r, m in
    switch m {
      case "AC": return (r.0 + 1, r.1, r.2, r.3)
      case "WA": return (r.0, r.1 + 1, r.2, r.3)
      case "TLE": return (r.0, r.1, r.2 + 1, r.3)
      case "RE": return (r.0, r.1, r.2, r.3 + 1)
      default: return (r.0, r.1, r.2, r.3)
    }
  }

print("AC x", judge.0)
print("WA x", judge.1)
print("TEL x", judge.2)
print("RE x", judge.3)
