let n = Int(readLine()!)!
var result = [0, 0, 0, 0]
for _ in 0..<n {
  let s = readLine()!
  if s == "AC" { result[0] += 1 }
  else if s == "WA" { result[1] += 1 }
  else if s == "TLE" { result[2] += 1 }
  else { result[3] += 1 }
}
print("AC x \(result[0])")
print("WA x \(result[1])")
print("TLE x \(result[2])")
print("RE x \(result[3])")