#include <bits/stdc++.h>
using namespace std;
int main() {
  string arr[1000000];
  int n;
  cin >> n;
  int count1 = 0;
  int count2 = 0;
  int count3 = 0;
  int count4 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i] == "AC") {
      count1++;
    } else if (arr[i] == "WA") {
      count2++;
    } else if (arr[i] == "TLE") {
      count3++;
    } else if (arr[i] == "RE") {
      count4++;
    }
  }
  if (count1 != 0) {
    cout << "AC"
         << " "
         << "*"
         << " " << count1 << endl;
  } else if (count1 == 0) {
    cout << "AC"
         << " "
         << "*"
         << " " << count1 << endl;
  }
  if (count2 != 0) {
    cout << "WA"
         << " "
         << "*"
         << " " << count2 << endl;
  } else if (count2 == 0) {
    cout << "WA"
         << " "
         << "*"
         << " " << count2 << endl;
  }
  if (count3 != 0) {
    cout << "TLE"
         << " "
         << "*"
         << " " << count3 << endl;
  } else if (count3 == 0) {
    cout << "TLE"
         << " "
         << "*"
         << " " << count3 << endl;
  }
  if (count4 != 0) {
    cout << "RE"
         << " "
         << "*"
         << " " << count4 << endl;
  } else if (count4 == 0) {
    cout << "RE"
         << " "
         << "*"
         << " " << count4 << endl;
  }
  system("pause");
  return 0;
}
