<?php
$rt = fgets(STDIN);
$A=0;
$B=0;
$C=0;
$D=0;
for ($i=0;$i<=$rt;$i++) {
  $line = fgets(STDIN);
  $array[] = trim($line);
}
unset($array[0]);
foreach($array as $value){
  if($value=='AC'){
    $A=$A+1;
  }elseif($value=='TLE'){
    $B=$B+1;
  }elseif($value=='WA'){
    $C=$C+1;
  }elseif($value=='RE'){
    $D=$D+1;
  }
}
echo 'AC x ' , $A."\n";
echo 'TLE x ' , $B."\n";
echo 'WA x ' , $C."\n";
echo 'RE x ', $D."\n";
?>