#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  string arr;
  long long int n1 = 0, n2 = 0, n3 = 0, n4 = 0, i;
  for (i = 0; i < n; i++) {
    cin >> arr;
    if (arr == "AC")
      n1++;
    else if (arr == "WA")
      n2++;
    else if (arr == "TLE")
      n3++;
    else if (arr == "RE")
      n4++;
  }
  cout << "AC"
       << " "
       << "X"
       << " " << n1 << endl;
  cout << "WA"
       << " "
       << "X"
       << " " << n2 << endl;
  cout << "TLE"
       << " "
       << "X"
       << " " << n3 << endl;
  cout << "RE"
       << " "
       << "X"
       << " " << n4 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
