#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int c[n + 1];
  string s[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    c[i] = 0;
  }
  cout << s[0] << endl;
  for (int i = 0; i < n; i++) {
    if (s[i] == "AC")
      c[0] = c[0] + 1;
    else if (s[i] == "WA")
      c[1] = c[1] + 1;
    else if (s[i] == "TLE")
      c[2] = c[2] + 1;
    else if (s[i] == "RE")
      c[3] = c[3] + 1;
  }
  cout << "AC x " << c[0] << endl;
  cout << "WA x " << c[1] << endl;
  cout << "TLE x " << c[2] << endl;
  cout << "RE x " << c[3] << endl;
  return 0;
}
