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