#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ac = 0;
  int tle = 0;
  int re = 0;
  int wa = 0;
  string p;
  while (n--) {
    cin >> p;
    if (p == "AC") {
      ac++;
    } else if (p == "TLE") {
      tle++;
    } else if (p == "WA") {
      wa++;
    } else {
      re++;
    }
  }
  vector<pair<int, string>> l;
  l.push_back({ac, "AC"});
  l.push_back({wa, "WA"});
  l.push_back({tle, "TLE"});
  l.push_back({re, "RE"});
  sort(l.rbegin(), l.rend());
  for (auto x : l) {
    cout << x.second << " x " << x.first << "\n";
  }
}
