#include<bits/stdc++.h>
using namespace std;
#define ll long long

/*class Node{
public:
    int data;
    Node* next;
};

Node* Insert(Node* head, int x, int pos){
    if(pos<1){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    int len=0;
    Node* temp=head;
    while(temp!=NULL){
        len++;
        temp=temp->next;
    }
    if(pos>(len+1)){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    temp=head;
    if(pos==1){
        Node* temp1=new Node();
        temp1->data=x;
        temp1->next=head;
        head=temp1;
        cout<<"Inserted Successfully..."<<endl;
        return head;
    }
    for(int i=1; i<(pos-1); i++){
        temp=temp->next;
    }
    Node* temp1=new Node();
    temp1->data=x;
    temp1->next=temp->next;
    temp->next=temp1;
    cout<<"Inserted Successfully..."<<endl;
    return head;
}

Node* Delete(Node* head, int pos){
    if(pos<1){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    int len=0;
    Node* temp=head;
    while(temp!=NULL){
        len++;
        temp=temp->next;
    }
    if(pos>len){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    temp=head;
    if(pos==1){
        Node *temp1=head->next;
        delete(temp);
        head=temp1;
        cout<<"Deleted Successfully..."<<endl;
        return head;
    }
    for(int i=1; i<(pos-1); i++){
        temp=temp->next;
    }
    Node* temp1=temp->next->next;
    delete(temp->next);
    temp->next=temp1;
    cout<<"Deleted Successfully..."<<endl;
    return head;
}

void print(Node* head){
    Node* temp=head;
    cout<<"Linked List is: ";
    while(temp!=NULL){
        cout<<temp->data<<' ';
        temp=temp->next;
    }
    cout<<endl;
}

Node* pairwise_swap(Node* head){*/
    /*Node* fast=head;
    while(fast && fast->next){
        int temp=fast->data;
        fast->data=fast->next->data;
        fast->next->data=temp;
        fast=fast->next->next;
    }
    cout<<"Swapping done..."<<endl;
    return head*/

    //OR

/*    if(head==NULL || head->next==NULL){
        return head;
    }
    Node* remaining=head->next->next;
    Node* newhead=head->next;
    head->next->next=head;
    head->next=pairwise_swap(remaining);
    cout<<"Swapping done..."<<endl;
    return newhead;
}

int main(){
    Node* head=NULL;
    cout<<"PLAY WITH LINKED LISTS..."<<endl;
    while(1){
        string str;
        cin>>str;
        if(str=="INSERT"){
            int x;
            cin>>x;
            int pos;
            cin>>pos;
            head=Insert(head, x, pos);
        }
        else if(str=="DELETE"){
            int pos;
            cin>>pos;
            head=Delete(head, pos);
        }
        else if(str=="PRINT"){
            print(head);
        }
        else if(str=="PAIRWISE_SWAP"){
            head=pairwise_swap(head);
        }
        else if(str=="EXIT"){
            cout<<"Hope you enjoyed playing...Visit Again"<<endl;
            break;
        }
        else{
            cout<<"INVALID COMMAND"<<endl;
        }
    }
}*/

int main(){
    int n;
    cin>>n;
    int a=0, b=0, c=0, d=0;
    for(int i=0; i<n; i++){
        string str;
        cin>>str;
        if(str=="AC"){
            a++;
        }
        else if(str=="WA"){
            b++;
        }
        else if(str=="TLE"){
            c++;
        }
        else{
            d++;
        }
    }
    cout<<"AC x "<<a<<endl<<"WA x "<<b<<endl<<"TLE x "<<c<<endl<<"RE x "<<d<<endl;
}


Measured memory_bytes: 3624