#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
struct que{
double sum;
int cnum;
int rnum;
int cnt[5];
bool ans[5];
int ar;
int max;
};
bool cmp2(que a,que b){
if(a.max == b.max) return a.ar < b.ar;
return a.max > b.max;
}
int main()
{
int N,M,choose;
char c;
cin >> N >>M;
que pro[M];
for(int i = 0;i < M;i++){
for(int j = 0;j < 5;j++) pro[i].ans[j] = false,pro[i].cnt[j] = 0;
cin >> pro[i].sum >> pro[i].cnum >> pro[i].rnum;
for(int j = 0;j < pro[i].rnum;j++){
cin >> c;
pro[i].ans[c-'a'] = true;
}
pro[i].ar = i+1;
}
while(N--){
double goal = 0;
for(int i = 0;i < M;i++){
bool nowans[5] = {false};
int rc = 0;
bool flag = true;
cin >> c >> choose;
while(choose--){
cin >> c;
if(pro[i].ans[c-'a']) rc++,nowans[c-'a'] = true;
else{
pro[i].cnt[c-'a']++;
flag = false;
}
}
for(int j = 0;j <5;j++)
if(nowans[j] == false && pro[i].ans[j] == true) pro[i].cnt[j]++;
if(flag && rc>0){
if(rc == pro[i].rnum) goal+=pro[i].sum;
else goal+=pro[i].sum/2;
}
cin >> c;
}
printf("%.1lf
",goal);
}
for(int i = 0;i < M;i++){
pro[i].max = 0;
for(int j = 0;j < 5;j++)
if(pro[i].cnt[j] > pro[i].max) pro[i].max = pro[i].cnt[j];
}
sort(pro,pro+M,cmp2);
for(int i = 0;i < M;i++){
if(pro[i].max == 0){
cout << "Too simple" << endl;
break;
}
else{
for(int j = 0;j < 5;j++)
if(pro[i].cnt[j] == pro[i].max) printf("%d %d-%c
",pro[i].max,pro[i].ar,j+'a');
}
if(pro[i+1].max != pro[i].max) break;
}
return 0;
}