#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0);
unsigned long long int binpow(unsigned long long int b,
                              unsigned long long int n) {
  if (n == 0) return 1;
  if (n == 1) return b;
  if (n & 1)
    return binpow(b, n - 1) * b;
  else
    return binpow(b * b, n / 2);
}
long long int bigmod(long long int a, long long int n, long long int mod) {
  if (n == 0) return 1;
  long long int res = bigmod(a, n / 2, mod);
  if (n & 1) {
    return ((res % mod) * (res % mod) * a) % mod;
  } else
    return ((res % mod) * (res % mod)) % mod;
}
void start() {}
void solve() {
  long long int n;
  cin >> n;
  map<string, int> mp;
  for (auto x : {"AC", "WA", "TLE", "RE"}) {
    mp[x] = 0;
  }
  while (n--) {
    string s;
    cin >> s;
    mp[s]++;
  }
  for (auto x : mp) {
    cout << x.first << " "
         << "x" << x.second << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
