#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long n;
  cin >> n;
  string s;
  int a = 0;
  int w = 0;
  int t = 0;
  int r = 0;
  for (long i = 0; i < n; i++) {
    cin >> s;
    if (s == "AC") {
      a++;
    }
    if (s == "WA") {
      w++;
    }
    if (s == "TLE") {
      t++;
    }
    if (s == "RE") {
      r++;
    }
  }
  cout << "AC"
       << " "
       << "*"
       << " " << a << endl;
  cout << "WA"
       << " "
       << "*"
       << " " << w << endl;
  cout << "TLE"
       << " "
       << "*"
       << " " << t << endl;
  cout << "RE"
       << " "
       << "*"
       << " " << r << endl;
  return 0;
}
