#include <bits/stdc++.h>
using namespace std;
int fact(int n) {
  if (n == 0)
    return 1;
  else
    return n * fact(n - 1);
}
void divisor(int n) {
  vector<long long int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      a[j]++;
    }
    cout << a[i] << " ";
  }
}
void divisor2(int n) {
  int cnt = 0;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) cnt++;
    if (n / i != i) cnt++;
  }
  cout << cnt;
}
void isPrime_sieve(int n) {
  bool marked[10005];
  memset(marked, true, sizeof(marked));
  for (int i = 2; i * i <= n; i++) {
    if (marked[i] == true) {
      for (int j = i * i; j <= n; j += i) {
        marked[j] = false;
      }
    }
  }
  for (int i = 2; i <= n; i++) {
    if (marked[i]) {
      cout << i << " ";
    }
  }
}
void move_brackets(int n, string s) {
  int op = 0, len = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      op++;
    } else {
      if (op) {
        op--;
        len += 2;
      }
    }
  }
  cout << (n - len) / 2 << '\n';
}
const long long int mx = 1e9 + 123;
int main(void) {
  long long int t, n, ans, d, m;
  cin >> t;
  string s;
  long long int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
  while (t--) {
    cin >> s;
    if (s == "AC") {
      cnt1++;
    } else if (s == "WA") {
      cnt2++;
    } else if (s == "TLE") {
      cnt3++;
    } else if (s == "WA") {
      cnt4++;
    }
  }
  cout << "AC"
       << " x " << cnt1 << '\n';
  cout << "WA"
       << " x " << cnt2 << '\n';
  cout << "TLE"
       << " x " << cnt3 << '\n';
  cout << "RE"
       << " x " << cnt4 << '\n';
}
