#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  map<string, int> m;
  for (int i = 0; i < n; i++) {
    cin >> s;
    m[s]++;
  }
  int f = 0;
  for (auto i : m) {
    if (i.first == "AC") {
      cout << i.first << " "
           << "*"
           << " " << i.second << "\n";
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << "AC"
         << " "
         << "*"
         << " "
         << "0"
         << "\n";
  f = 0;
  for (auto i : m) {
    if (i.first == "WA") {
      cout << i.first << " "
           << "*"
           << " " << i.second << "\n";
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << "WA"
         << " "
         << "*"
         << " "
         << "0"
         << "\n";
  f = 0;
  for (auto i : m) {
    if (i.first == "TLE") {
      cout << i.first << " "
           << "*"
           << " " << i.second << "\n";
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << "TLE"
         << " "
         << "*"
         << " "
         << "0"
         << "\n";
  f = 0;
  for (auto i : m) {
    if (i.first == "RE") {
      cout << i.first << " "
           << "*"
           << " " << i.second << "\n";
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << "RE"
         << " "
         << "*"
         << " "
         << "0"
         << "\n";
}
