#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  while (n--) {
    string s;
    cin >> s;
    if (s == "AC") {
      mp[s]++;
    }
    if (s == "WA") {
      mp[s]++;
    }
    if (s == "TLE") {
      mp[s]++;
    }
    if (s == "RE") {
      mp[s]++;
    }
  }
  for (auto i = mp.begin(); i != mp.end(); i++) {
    cout << i->first << " "
         << "x"
         << " " << i->second << endl;
  }
}
