#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, n, m, t;
  long long sum = 0;
  cin >> t;
  map<string, int> mp;
  while (t--) {
    string str;
    cin >> str;
    mp[str]++;
  }
  bool ok = true;
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    if (it->first == "AC") {
      cout << it->first << " "
           << "*"
           << " " << it->second << endl;
      ok = false;
    }
  }
  if (ok)
    cout << "AC"
         << " "
         << "*"
         << " " << 0 << endl;
  ok = true;
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    if (it->first == "WA") {
      cout << it->first << " "
           << "*"
           << " " << it->second << endl;
      ok = false;
    }
  }
  if (ok)
    cout << "WA"
         << " "
         << "*"
         << " " << 0 << endl;
  ok = true;
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    if (it->first == "TLE") {
      cout << it->first << " "
           << "*"
           << " " << it->second << endl;
      ok = false;
    }
  }
  if (ok)
    cout << "TLE"
         << " "
         << "*"
         << " " << 0 << endl;
  ok = true;
  ok = true;
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    if (it->first == "RE") {
      cout << it->first << " "
           << "*"
           << " " << it->second << endl;
      ok = false;
    }
  }
  if (ok)
    cout << "RE"
         << " "
         << "*"
         << " " << 0 << endl;
  ok = true;
  return 0;
}
