#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    vector<string> J(3);
    J = {"AC","WA","TLE","RE"}
    vector<int> C(3);
    rep(i, N + 1){
	cin >> S(i);
	rep(m, 4){
	    if(S(i) == J(m)){
		C(m) += 1;
	    }
	}
    }
    rep(i, 4){
	cout << J(i) + "*" + C(i) << endl;
    }
}