#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans;
  cin >> n;
  map<string, int> m;
  m["WA"] = 0, m["TLE"] = 0, m["RE"] = 0, m["AC"] = 0;
  while (n--) {
    string s;
    cin >> s;
    m[s]++;
  }
  for (auto u : m) {
    printf("%s x %d\n", u.first.c_str(), u.second);
  }
  return 0;
}
