#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  map<string, long long int> m;
  m["WA"]++;
  m["TLE"]++;
  m["AC"]++;
  m["RE"]++;
  while (t--) {
    string a;
    cin >> a;
    m[a]++;
  }
  cout << "AC"
       << " "
       << "*"
       << " " << m["AC"] - 1 << endl;
  cout << "WA"
       << " "
       << "*"
       << " " << m["WA"] - 1 << endl;
  cout << "TLE"
       << " "
       << "*"
       << " " << m["TLE"] - 1 << endl;
  cout << "RE"
       << " "
       << "*"
       << " " << m["RE"] - 1 << endl;
}
