#include<cstdio>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
string s;
struct node{
int num;
string name;
}a[101];
bool cmp(const node& a,const node& b){
return a.num>b.num;
}
int main(){
freopen("save.in","r",stdin),freopen("save.out","w",stdout);
int n,ans;
scanf("%d",&n);
for(int i=0;i<n;++i){
cin>>a[i].name>>s;
for(int j=2;j<s.length();++j) a[i].num+=(s[j-2]=='s'&&s[j-1]=='o'&&s[j]=='s');
}
sort(a,a+n,cmp),ans=a[0].num;
for(int i=0;!(ans^a[i].num);++i) cout<<a[i].name<<" ";
printf("\n%d",ans);
return 0;
}
回家一测,直接雷击