#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  string s;
  cin >> t;
  while (t--) {
    cin >> s;
    if (s == "AC")
      c1++;
    else if (s == "WA")
      c2++;
    else if (s == "TLE")
      c3++;
    else if (s == "RE")
      c4++;
  }
  cout << "AC"
       << " "
       << "X"
       << " " << c1 << endl;
  cout << "WA"
       << " "
       << "X"
       << " " << c2 << endl;
  cout << "TLE"
       << " "
       << "X"
       << " " << c3 << endl;
  cout << "RE"
       << " "
       << "X"
       << " " << c4 << endl;
}
