/*
  AOJ 1238
  Title:True Liars
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int n,p1,p2;
int relation[300][300];
char devine[300];
char result[300];

int search_miketu(char devine[])
{
  int i;
  for(i=1;i<=p1+p2;i++)
    if(devine[i]==0)
      return(i);
  return(0);
}
void count_(char devine[],int *honest,int *liar)
{
  int i;
  *honest=*liar=0;
  for(i=1;i<=p1+p2;i++)
    {
      *honest += ((devine[i]== 1)?1:0);
      *liar   += ((devine[i]==-1)?1:0);
    }
}
void decide(char devine[],int start,int val)
{
  int i,r;

  devine[start]=val;
  for(i=1;i<=p1+p2;i++)
    if((r=relation[start][i]) && devine[i]==0)
      decide(devine,i,r*val);
}
void dump(char devine[])
{
  int i;

  for(i=1;i<=p1+p2;i++)
    printf("%d:",devine[i]);
  printf("\n");
}

int solve2(char devine[])
{
  char my_devine[300];
  int hon,lia,ret1,ret2,mik;

  //dump(devine);
  mik=search_miketu(devine);
  count_(devine,&hon,&lia);
  //printf("miketu=%d h=%d l=%d\n",mik,hon,lia);
  if(mik==0)
    {
      if(hon==p1 || lia==p2)
	{
	  memcpy(result,devine,300);
	  return(1);
	}
      else
	return(0);
    }

  if(hon >p1)
    return(0);
  if(lia >p2)
    return(0);

  memcpy(my_devine,devine,300);
  decide(my_devine,mik,1);
  ret1=solve2(my_devine);
  memcpy(my_devine,devine,300);
  decide(my_devine,mik,-1);
  ret2=solve2(my_devine);
  
  return(ret1+ret2);
}

int solve()
{
  int ret;
  
  ret=solve2(devine);
  return((ret==1)?1:0);
}

void write_devine(char devine[])
{
  int i;
  for(i=1;i<=p1+p2;i++)
    if(devine[i]==1)
      printf("%d\n",i);
  printf("end\n");
	
}
main()
{
  int i,x,y,ret;
  char s[4];

  while(scanf("%d %d %d",&n,&p1,&p2) && (n||p1||p2))
    {
      memset(relation,0,sizeof(int)*300*300);
      memset(devine,-2,300);
      for(i=0;i<n;i++)
	{
	  scanf("%d %d %s",&x,&y,s);
	  if(s[0]=='y')
	    relation[x][y]=relation[y][x]=1;
	  else if(s[0]=='n')
      	    relation[x][y]=relation[y][x]=-1;
	  devine[x]=devine[y]=0;
	}
      ret=solve();
      if(ret)
	write_devine(result);
      else
	printf("no\n");
    }
  return(0);
}