#include <bits/stdc++.h>
using namespace std;
char a[100005] = {0};
int main() {
  string str;
  int i;
  cin >> i;
  int count = 0, cnt = 0, num = 0, n = 0;
  vector<string> vec;
  for (int j = 0; j < i; j++) {
    cin >> str;
    vec.push_back(str);
    for (int i = 0; i < str.size(); i++) {
      if (str[0] == 'A' && str[1] == 'C') count++;
      if (str[0] == 'W' && str[1] == 'A') cnt++;
      if (str[0] == 'T' && str[1] == 'L' && str[2] == 'E') num++;
      if (str[0] == 'R' && str[1] == 'E') n++;
    }
  }
  cout << "AC"
       << " x " << count / 2 << endl;
  cout << "WA"
       << " x " << cnt / 2 << endl;
  cout << "TLE"
       << " x " << num / 3 << endl;
  cout << "RE"
       << " x " << n << endl;
  return 0;
}
