function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    var N = parseInt(input[0][0], 10);
    var count = [0, 0, 0, 0];
    for (var i = 0; i < N; i++){
        if (input[i + 1][0] === "AC") count[0]++;
        if (input[i + 1][0] === "WA") count[1]++;
        if (input[i + 1][0] === "TLE") count[2]++;
        if (input[i + 1][0] === "RE") count[3]++;
    }

    console.log("AC x %d", count[0]);
    console.log("WA x %d", count[1]);
    console.log("TLE x %d", count[2]);
    console.log("RE x %d", count[3]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 