#include <bits/stdc++.h>
using namespace std;
struct Node
{
int full;
set<char>ss;
map<char,int>mp;
};
int N,M,K,t;
int Maxt = 0;
vector<Node>v;
map<char,int>mp;
//s1是学生的答案
int isContain(set<char>s1,set<char>s2)
{
if(s1.size()>=s2.size()) return 0;
for(auto it = s1.begin();it != s1.end();it++)
{
if(!s2.count(*it)) return 0;
}
return 1;
}
void addWrong(set<char>s1,set<char>s2,int t)
{
for(auto it = s1.begin();it!=s1.end();it++)
{
if(!s2.count(*it))
{
v[t].mp[*it]++;
Maxt = max(Maxt,v[t].mp[*it]);
}
}
for(auto it = s2.begin();it!=s2.end();it++)
{
if(!s1.count(*it))
{
v[t].mp[*it]++;
Maxt = max(Maxt,v[t].mp[*it]);
}
}
}
bool cmp(const pair<char,int> & p1,const pair<char,int>p2)
{
if(p1.first!=p2.first)
{
return p1.first < p2.first;
} else{
return p1.second < p2.second;
}
}
int main() {
char c;
cin>>N>>M;
for(int i = 0;i<M;i++)
{
Node node;
cin>>node.full>>t>>K;
for(int j = 0;j<K;j++)
{
cin>>c;
node.ss.insert(c);
}
v.push_back(node);
}
//N
for(int i = 0;i<N;i++)
{
double ans = 0;
getchar();
for(int j = 0;j<M;j++)
{
if(j) scanf(" ");
scanf("(%d",&K);
set<char>tmp;
for(int k = 0;k<K;k++)
{
scanf(" %c",&c);
tmp.insert(c);
}
scanf(")");
if(tmp == v[j].ss) ans += v[j].full;
else
{
addWrong(tmp,v[j].ss,j);
if(isContain(tmp,v[j].ss)) ans += v[j].full*0.5;
}
}
printf("%.1f\n",ans);
}
vector<pair<int,char>>wrong;
for(int i = 0;i<M;i++)
{
for(auto it = v[i].mp.begin();it!=v[i].mp.end();it++)
{
if(it->second == Maxt)
{
wrong.push_back(make_pair(i+1,it->first));
// cout<<i+1<<" "<<it->first<<endl;
}
}
}
if(wrong.size() == 0)
{
cout<<"Too simple"<<endl;
} else{
sort(wrong.begin(),wrong.end(),cmp);
for(int i = 0;i<wrong.size();i++)
{
cout<<Maxt<<" "<<wrong[i].first<<"-"<<wrong[i].second<<endl;
}
}
return 0;
}
/**
3 4
3 4 2 a c
2 5 1 b
5 3 2 b c
1 5 4 a b d e
(2 a c) (3 b d e) (2 a c) (3 a b e)
(2 a c) (1 b) (2 a b) (4 a b d e)
(2 b d) (1 e) (1 c) (4 a b c d)
**/