unittest
{
	assert( [ "6", "AC", "TLE", "AC", "AC", "WA", "TLE" ].solve == "AC x 3\nWA x 1\nTLE x 2\nRE x 0" );
	assert( [ "10", "AC", "AC", "AC", "AC", "AC", "AC", "AC", "AC", "AC", "AC" ].solve == "AC x 10\nWA x 0\nTLE x 0\nRE x 0" );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto ss = new dchar[][ n ];
	foreach( ref s; ss )
	{
		input.popFront;
		s = input.front.to!( dchar[] );
	}
	
	auto ac = 0L;
	auto wa = 0L;
	auto tle = 0L;
	auto re = 0L;
	foreach( s; ss )
	{
		final switch( s )
		{
			case "AC" : ac++;  break;
			case "WA" : wa++;  break;
			case "TLE": tle++; break;
			case "RE" : re++;  break;
		}
	}
	return format( "AC x %s\nWA x %s\nTLE x %s\nRE x %s", ac, wa, tle, re );
}
