// Slower C++ solution:
#include <iostream>

#include <bits/stdc++.h>

#include<string>

#include <stdio.h>

#include <algorithm>

#include <math.h>

#include <fstream>

#include <vector>



#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define ll long long

#define SPACE " "

#define nLINE '\n'

#define ss second

#define ff first

//scanf("%d",&x) ,s.insert(x);

using namespace std;



ll GCD(ll a, ll b) {

	//Euclidian

	if (!b) return a;

	else return GCD(b, a % b);

}

const ll MAX = 51;

bool prime[MAX];

void sieve() {

	for (int p = 2; p * p <= MAX; p++)

		if (prime[p] == false)

			for (int i = p * 2; i <= MAX; i += p)

				prime[i] = true;

}



int comb(int a, int b)

{

	if (a < b) return 0;

	if (a == b) return 1;

	if (b == 0) return 1;

	return comb(a - 1, b) + comb(a - 1, b - 1);

}

int x[30];

long long int y[30];

long long int func(int s, int t)

{

	if (t == 0) return 1;

	if (s == 0) return 1;



	if (x[s] == 0) return func(s - 1, t);

	else

	{

		long long int sum = 0;

		for (int i = 0;i <= t;i++) sum += comb(s - 1, i) * y[i];



		long long int s1 = sum;



		sum = 0;

		for (int i = 0;i <= t - 1;i++) sum += comb(s - 1, i) * y[i];

		long long int s2 = (x[s] - 1) * sum;

		long long int s3 = func(s - 1, t - 1);

		return s1 + s2 + s3;

	}

}







int dp[13][1 << 13];

double arr[20][20];

int n;

int dvds[13],svs[13];

vector<double> sssp(int);

vector<double> minDis[20];

int Size;



double solve(int current, int mask) {

    if(mask == ((1 << Size) - 1)) return -arr[dvds[current]][0];



    if(dp[current][mask] != -1)

        return dp[current][mask];





    double Max = -arr[dvds[current]][0];

    for(int i= 0; i< Size; i++)

        if((mask & (1 << i)) == 0)

            Max = max(Max, svs[i] - arr[dvds[current]][dvds[i]]+ solve(i, mask | (1 << i)));



    return dp[current][mask]= Max;

}



int nextMin(int,int);



int main() {

	ll t;

	ll AC=0,WA=0,TLE=0,RE=0;

	cin >> t;

	while(t--){

        string s;

        cin >>s;

        if(s=="AC") AC++;

        else if(s=="WA") WA++;

        else if(s=="TLE") TLE++;

        else if(s=="RE") RE++;

	}

	cout << "AC x " << AC << nLINE <<"WA x " << WA << nLINE << "TLE x " << TLE << nLINE << "RE x " << RE << nLINE;

}



bool used[20];

vector<double> sssp(int src) {

	vector<double> disSource(n);

	fill(disSource.begin(), disSource.end(), INT_MAX);

	disSource[src] = 0;

	int curr = src;

	memset(used, false, sizeof used);

	used[curr] = true;

	while (curr != -1) {

		for (int j = 0;j < n;j++) {

			if (arr[curr][j] != -1) {

				if (disSource[j] == INT_MAX) disSource[j] = arr[curr][j] + disSource[curr];

				else disSource[j] = std::min(disSource[j], disSource[curr] + arr[curr][j]);

			}

		}

		used[curr] = true;

		curr = nextMin(curr,src);

	}

	return disSource;

}



int nextMin(int curr,int src) {

	int indx = -1;

	double Min = 1e9;

	for (int i = 0;i < n;i++) {

		if (arr[curr][i]!=-1 && arr[curr][i] <= Min && used[i] == false) {

			Min = arr[curr][i];

			indx = i;

		}

	}

	if (indx == -1){

        for(int i=0;i<n;i++)

            if(arr[src][i]!=-1 && arr[curr][i] <= Min && used[i]== false)

                indx = i , Min = arr[curr][i];

	}

	if (indx == -1) return -1;

	return indx;

}


// Faster C++ solution for the same problem (measured speedup: 5.238397470330681x):
#include <stdio.h>

#include <string.h>



int main (){

	int N, AC = 0, WA = 0, TLE = 0, RE = 0;

	scanf ("%d", &N);

	

	for (int i = 0; i < N; i++){

		char str[10];

		scanf ("%s", str);

	if (strcmp(str, "AC") == 0) { // "AC" - "AC" = 0

		AC++;

	}

	else if (strcmp(str, "WA") == 0) { // "AC" - "AC" = 0

		WA++;

	}

	else if (strcmp(str, "TLE") == 0) { // "AC" - "AC" = 0

		TLE++;

	}

	else if (strcmp(str, "RE") == 0) { // "AC" - "AC" = 0

			RE++;

		}

	}

	

	printf ("AC x %d\n", AC); 

	printf ("WA x %d\n", WA);

	printf ("TLE x %d\n", TLE);

	printf ("RE x %d\n", RE);

	

	return 0;

}