#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  long a = 0, b = 0, c = 0, d = 0;
  while (t--) {
    string s;
    cin >> s;
    if (s == "AC")
      a++;
    else if (s == "WA")
      b++;
    else if (s == "TLE")
      c++;
    else
      d++;
  }
  cout << "AC"
       << " " << '*' << " " << a << endl;
  cout << "WA"
       << " " << '*' << " " << b << endl;
  cout << "TLE"
       << " " << '*' << " " << c << endl;
  cout << "RE"
       << " " << '*' << " " << d << endl;
}
