#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int test = 0; test < n; test++) {
    vector<string> v;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      v.push_back(s);
    }
    cout << "AC x " << count(v.begin(), v.end(), "AC") << "\n";
    cout << "WA x " << count(v.begin(), v.end(), "WA") << "\n";
    cout << "TLE x " << count(v.begin(), v.end(), "TLE") << "\n";
    cout << "RE x " << count(v.begin(), v.end(), "RE") << "\n";
  }
}
