#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define int long long
int n,m,k;
int vis[110][110];
int key[110];
int ans=0;
void check(int x)
{
int wei=0,tf=0;
int cntt=0;
while(x)
{
wei++;
tf=x%2;
if(tf)cntt++;
x/=2;
key[wei]=tf;
}
if(cntt<k)return;
for(int i=1;i<=m;i++)
{
int tt=0,ff=0;
for(int j=1;j<=n;j++)
{
if(vis[i][j]==2 && key[j]==1)ff++;
if(vis[i][j]==1 && key[j]==1)tt++;
}
if(ff>=k)return;
if(tt<k && tt!=0)return;
}
ans++;
}
signed main()
{
IOS
cin>>n>>m>>k;
for(int i=1;i<=m;i++)
{
int cccc;
cin>>cccc;
for(int j=1;j<=cccc;j++)
{
cin>>key[j];
}
char typ;
cin>>typ;
int fuzhi=0;
if(typ=='o')
fuzhi=1;
else fuzhi=2;
for(int j=1;j<=cccc;j++)
vis[i][key[j]]=fuzhi;
}
for(int i=0;i<(1<<n);i++)
{
memset(key,0,sizeof(key));
check(i);
}
cout<<ans;
return 0;
}