#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int n,d;
double e;
int a,b;
int main(void)
{
cin>>n>>e>>d;
for(int i=0;i<n;i++)
{
int k,s1,s2; cin>>k;
s1=0,s2=0;
for(int i=0;i<k;i++)
{
double x; cin>>x;
if(x<e) s1++;
else s2++;
}
if(s1>s2&&k>d) b++;
else if(s1>s2) a++;
}
printf("%.1lf%% %.1lf%%\n",a*100.0/n,b*100.0/n);
return 0;
}