#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ac_count = 0;
  int wa_count = 0;
  int tle_count = 0;
  int re_count = 0;
  while (n--) {
    string str;
    cin >> str;
    if (str.at(0) == 'A') {
      ac_count++;
    } else if (str.at(0) == 'W') {
      wa_count++;
    } else if (str.at(0) == 'T') {
      tle_count++;
    } else if (str.at(0) == 'R') {
      re_count++;
    }
  }
  for (int i = 1; i <= ac_count; i++) {
    cout << "AC" << endl;
  }
  for (int i = 1; i <= tle_count; i++) {
    cout << "TLE" << endl;
  }
  for (int i = 1; i <= wa_count; i++) {
    cout << "WA" << endl;
  }
  for (int i = 1; i <= re_count; i++) {
    cout << "RE" << endl;
  }
  return 0;
}
