#include<iostream>
#include<string>
using namespace std;
int main(void)
{
	int score = 0;
	int runner = 0;
	int out = 0;
	int inning = 1;
	int inning_limit;
	cin>>inning_limit;
	int inning_score[34] = {};
	int insc = 0;
	bool rui_1 = false;
	bool rui_2 = false;
	bool rui_3 = false;
	string hit[100];
	int i = 0;
	while(cin>>hit[i]){
		i++;
	}
	for(int j = 0;j<i;j++){
		if(hit[j] == "HIT"){
			if(rui_3==true){
				insc++;
				rui_3=false;
			}else{
				runner--;
			}
			rui_3 = rui_2;
			rui_2 = rui_1;
			rui_1 = true;
			runner++;
		}else if(hit[j] == "HOMERUN"){
			insc += runner + 1;
			runner = 0;
		}else if(hit[j] == "OUT"){
			out++;
			if(out== 3){
				inning++;
				runner = 0;
				out = 0;
				inning_score[inning] = insc;

				score += insc;
				if(inning > inning_limit){
					break;
				}
			}
		}
	}

	for(int i = 1; i < inning_limit;i++){
		cout<<inning_score[i]<<endl;
	}

	return 0;
}