#include <stdio.h>
#include <math.h>

const char *moos[3] = {"lobster", "fish", "yes"};

void
demoo(void)
{
   char b[16384], buf[8][16384];
   int c, i, num, ii;
	
   while (fgets(b, 16383, stdin))
     {
	num = sscanf(b, "%s %s %s %s %s %s %s %s", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
	c = 0;
	for (i = 0; i < num; i++)
	  {
	     ii = (int)pow(3, i);
	     if (!strcmp(buf[i], "lobster")) c += (ii) * 0;
	     else if (!strcmp(buf[i], "fish")) c += (ii) * 1;
	     else if (!strcmp(buf[i], "yes")) c += (ii) * 2;
	  }
	putchar(c);
     }
}

void
moo(void)
{
   int c, a;
   
   while ((c = getchar()) != EOF)
     {
	while (c > 0)
	  {
	     a = c / 3;
	     printf("%s ", moos[c - (a * 3)]);
	     c = a;
	  }
	printf("\n");
     }
}

int
main(int argc, char **argv)
{
   if ((argc == 2) && (!strcmp(argv[1], "-d"))) demoo();
   else moo();
}
