#include <ctype.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#define char2int(ch) ((isdigit(ch))?(ch-'0'+26):(ch-'a'))struct Prob{ char ac; int sub; int time;};struct Prob p[9];void show(char prob,struct Prob *p){ putchar(prob); if(p->ac) printf(" %d %.2lf %.2lfn",p->ac,(double)p->sub/p->ac,(double)p->time/p->ac); else printf(" 0n");}struct Team{ struct Prob p[9];};struct Team t[2000];struct Trie{ int mark; struct Trie *p[36];};struct Trie root;int size;void init(struct Trie *p){ int i; p->mark=-1; for(i=0;i<36;i++) p->p[i]=NULL;}void clear(struct Trie *p){ int i; for(i=0;i<36;i++){ if(p->p[i]==NULL) continue; else{ clear(p->p[i]); free(p->p[i]); } }}int find(struct Trie *t,char *p){ int next=char2int(*p); if(*p==' '){ if(t->mark!=-1) return t->mark; else return t->mark=size++; } else{ if(t->p[next]==NULL) init(t->p[next]=(struct Trie*)malloc(sizeof(struct Trie))); return find(t->p[next],p+1); }}void doit(int time,char *team,char prob,char ac){ int tid=find(&root,team); int pid=prob-'A'; if(t[tid].p[pid].ac) return; t[tid].p[pid].sub++; if(ac=='A'){ t[tid].p[pid].ac=1; p[pid].ac++; p[pid].sub+=t[tid].p[pid].sub; p[pid].time+=time; }}int main(){ int blank=0,i,n,time; char team[6],prob[3],res[3]; while(scanf("%d",&n)!=EOF){ if(blank) putchar('n'); else blank=1; memset(p,0,sizeof(p)); memset(t,0,sizeof(t)); size=0; init(&root); for(i=0;i<n;i++){ scanf("%d%s%s%s",&time,team,prob,res); doit(time,team,*prob,*res); } clear(&root); for(i=0;i<9;i++) show('A'+i,&p[i]); } return 0; }