#include<bits/stdc++.h>
using namespace std;
int M,N,P;
string name[25];
string Day[15]={"","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
struct zy
{
int lx;
string sayer;
string jg;
}a[105];
string happy="";
void fz(string s,int num)
{
int k=s.find(':');
string man=s.substr(0,k);
string say=s.substr(k+2);
a[num].sayer=man;
if(say=="I am guilty.")
{
a[num].lx=1;
return ;
}
if(say=="I am not guilty.")
{
a[num].lx=2;
return ;
}
int k2=say.find(' ');
string men2=say.substr(0,k2),say2=say.substr(k2+1);
bool can=false;
for(int i=1;i<=M;i++)
if(men2==name[i]) can=true;
if(can)
{
if(say2=="is guilty.")
{
a[num].lx=3;
a[num].jg=men2;
return ;
}
else
{
if(say2=="is not guilty.")
{
a[num].lx=4;
a[num].jg=men2;
return ;
}
else
{
a[num].lx=6;
return ;
}
}
}
else
{
if(men2=="Today")
{
if(say2[0]=='i' && say2[1]=='s')
{
string day2=say2.substr(3);
bool can=false;
day2.replace(day2.size()-1,1,"");
for(int i=1;i<=7;i++)
if(day2==Day[i]) can=true;
if(can)
{
a[num].lx=5;
a[num].jg=day2;
return ;
}
else
{
a[num].lx=6;
return ;
}
}
else
{
a[num].lx=6;
return ;
}
}
else
{
a[num].lx=6;
return ;
}
}
}
string s[105];
map<string,bool> qwq,qwq2;
map<string,bool> fhdw;
int main()
{
scanf("%d%d%d",&M,&N,&P);
for(int i=1;i<=M;i++)
cin>>name[i];
for(int i=1;i<=P+1;i++)
{
getline(cin,s[i]);
string s;
while(s[s.size()-1]=='\r'|| s[s.size()-1]=='\n')
s.replace(s.size()-1,1,"");
}
for(int i=2;i<=P+1;i++)
fz(s[i],i-1);
for(int i=1;i<=P;i++)
{
if(a[i].lx!=6) fhdw[a[i].sayer]=true;
}
int fh=0;
for(int i=1;i<=M;i++)
if(!fhdw[name[i]]) fh++;
for(int week=1;week<=7;week++)
{
for(int killer=1;killer<=M;killer++)
{
int ans=0;
for(int i=1;i<=M;i++)
qwq[name[i]]=false;
for(int i=1;i<=P;i++)
{
if(a[i].lx==6) continue;
if(a[i].lx==1 && a[i].sayer!=name[killer])
{
if(!qwq[a[i].sayer]) ans++;
qwq[a[i].sayer]=true;
}
if(a[i].lx==2 && a[i].sayer==name[killer])
{
if(!qwq[a[i].sayer]) ans++;
qwq[a[i].sayer]=true;
}
if(a[i].lx==3)
{
if(qwq[a[i].sayer])
{
if(a[i].jg==name[killer]) ans=0x3f3f3f3f;
continue;
}
else
{
if(a[i].jg!=name[killer])
{
qwq[a[i].sayer]=true;
ans++;
}
}
}
if(a[i].lx==4)
{
if(qwq[a[i].sayer])
{
if(a[i].jg!=name[killer]) ans=0x3f3f3f3f;
continue;
}
else
{
if(a[i].jg==name[killer])
{
qwq[a[i].sayer]=true;
ans++;
}
}
}
if(a[i].lx==5)
{
if(qwq[a[i].sayer])
{
if(a[i].jg==Day[week]) ans=0x3f3f3f3f;
continue;
}
else
{
if(a[i].jg!=Day[week])
{
qwq[a[i].sayer]=true;
ans++;
}
}
}
}
if(ans==N || (ans<N && N-ans<=fh))
{
bool can2=true;
for(int k=1;k<=P;k++)
{
if(qwq[a[k].sayer])
{
if(a[k].lx==1 && a[k].sayer==name[killer]) can2=false;
if(a[k].lx==2 && a[k].sayer!=name[killer]) can2=false;
if(a[k].lx==3 && a[k].jg==name[killer]) can2=false;
if(a[k].lx==4 && a[k].jg!=name[killer]) can2=false;
if(a[k].lx==5 && a[k].jg==Day[week]) can2=false;
}
}
if(can2)
{
if(happy!="" && happy!=name[killer])
{
printf("Cannot Determine");
return 0;
}
else happy=name[killer];
}
}
}
}
if(happy=="") printf("Impossible");
else cout<<happy;
return 0;
}