#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0, d = 0, e = 0, f = 0;
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    if (s == "AC")
      c++;
    else if (s == "WA")
      d++;
    else if (s == "TLE")
      e++;
    else if (s == "RE")
      f++;
  }
  cout << "AC"
       << " "
       << "X"
       << " " << c << endl;
  cout << "WA"
       << " "
       << "X"
       << " " << d << endl;
  cout << "TLE"
       << " "
       << "X"
       << " " << e << endl;
  cout << "RE"
       << " "
       << "X"
       << " " << f << endl;
}
