#include <stdio.h>

char zad[100][100];

void pospieces(char p, char *desc, char *sep, int dir)
{
	int init = dir ? 0 : 7, step = dir ? 1 : -1, final = dir ? 8 : -1;
	int row, col;

	for (row = init; row != final; row += step)
		for (col = 0; col < 8; col++)
		{
			if (zad[15 - 2 * row][2 + 4 * col] == p)
			{
				printf ("%s%s", sep, desc);
				printf ("%c", col + 'a');
				printf ("%d", row + 1);
			}
		}
}

int main(void)
{
   int i;

   for (i = 0; i < 17; i++)
	   gets(zad[i]);

   printf ("White: ");
   pospieces('K',"K","",1);
   pospieces('Q',"Q",",",1);
   pospieces('R',"R",",",1);
   pospieces('B',"B",",",1);
   pospieces('N',"N",",",1);
   pospieces('P',"",",",1);
   printf ("\n");

   printf ("Black: ");
   pospieces('k',"K","",0);
   pospieces('q',"Q",",",0);
   pospieces('r',"R",",",0);
   pospieces('b',"B",",",0);
   pospieces('n',"N",",",0);
   pospieces('p',"",",",0);
   printf ("\n");
   return 0;
}

