#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  string s;
  cin >> t;
  int a[6] = {0};
  while (t--) {
    cin >> s;
    if (s == "AC") a[1]++;
    if (s == "WA") a[2]++;
    if (s == "TLE") a[3]++;
    if (s == "RE") a[4]++;
  }
  for (int i = 1; i <= 4; i++) {
    if (i == 1)
      cout << "AC"
           << "*" << a[i] << endl;
    if (i == 2)
      cout << "WA"
           << "*" << a[i] << endl;
    if (i == 3)
      cout << "TLE"
           << "*" << a[i] << endl;
    if (i == 4)
      cout << "RE"
           << "*" << a[i] << endl;
  }
  return 0;
}
