#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  vector<ll> vec(4);
  for (ll i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "AC") {
      vec[0]++;
    } else if (S == "WA") {
      vec[1]++;
    } else if (S == "TLE") {
      vec[2]++;
    } else {
      vec[3]++;
    }
  }
  cout << "AC"
       << " "
       << "X"
       << " " << vec[0] << endl;
  cout << "WA"
       << " "
       << "X"
       << " " << vec[1] << endl;
  cout << "TLE"
       << " "
       << "X"
       << " " << vec[2] << endl;
  cout << "RE"
       << " "
       << "X"
       << " " << vec[3] << endl;
}
