#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  int x[4] = {0};
  cin >> t;
  while (t--) {
    char y[5];
    cin >> y;
    if (y[0] == 'A')
      x[0]++;
    else if (y[0] == 'W')
      x[1]++;
    else if (y[0] == 'T')
      x[2]++;
    else
      x[3]++;
  }
  cout << "ACx" << x[0] << endl;
  cout << "WAx" << x[1] << endl;
  cout << "TLEx" << x[2] << endl;
  cout << "REx" << x[3];
  return 0;
}
