#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  map<string, int> m;
  m["AC"] = 0;
  m["WA"] = 0;
  m["TLE"] = 0;
  m["RE"] = 0;
  int n;
  string s;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    m[s]++;
  }
  for (auto x : m) {
    cout << x.first << "x" << x.second << "\n";
  }
}
