#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
struct node{
string name;
int num;
int count=0;
};
node arr[100];
int cmp(node n1,node n2){
if(n1.num == n2.num){
return n1.count<n2.count;
}
else return n1.num>n2.num;
}
int main(){
int n,t=0,len;
string name,lab;
set<string>st;
cin >> n;
while(n--){
st.clear();
cin >> name >> len;
while(len--){
cin >> lab;
st.insert(lab);
arr[t].count++;
}
arr[t].name = name;
arr[t].num = st.size();
t++;
}
sort(arr,arr+t,cmp);
if(t<3){
for(int i=0;i<t;i++)
cout << arr[i].name << " ";
for(int j=t;j<2;j++)
cout <<"-"<<" ";
cout << "-" << endl;
}
else{
for(int i=0;i<2;i++)
cout << arr[i].name<<" ";
cout << arr[2].name << endl;
}
}
天梯赛 点赞狂魔
于 2022-04-22 10:56:32 首次发布