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