/*
http://acm.pku.edu.cn/JudgeOnline/problem?id=2996
black::小写,行从小到大
white:大写,行从大到小
若行相同,则都按照列从小到大排列
棋盘排列如下:
8
7
6
5
4
3
2
1
a b c d e f g h
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
const int INF=(1<<31)-1;
const double EPS=1e-8;
char chess[10][50];
char line[50];
char black[7]="kqrbnp";
char white[7]="KQRBNP";
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int i,j,k,t;
gets(line);
for(i=8;i>=1;i--)
{
gets(chess[i]);
gets(line);
}
cout<<"White: ";
int flag=true;
for(int q=0;q<6;q++)
{
for(i=1;i<=8;i++)
{
for(j=2,k=1;j<=30;j+=4,k++)
{
if(white[q]==chess[i][j])
{
if(flag){flag=false;}
else printf(",");
if(q!=5)
printf("%c%c%d",white[q],k-1+'a',i);
else
printf("%c%d",k-1+'a',i);
}
}
}
}
cout<<endl;
cout<<"Black: ";
flag=true;
for(int q=0;q<6;q++)
{
for(i=8;i>=1;i--)
{
for(j=2,k=1;j<=30;j+=4,k++)
{
if(black[q]==chess[i][j])
{
if(flag){flag=false;}
else printf(",");
if(q!=5)
printf("%c%c%d",white[q],k-1+'a',i);
else
printf("%c%d",k-1+'a',i);
}
}
}
}
cout<<endl;
system("pause");
return 0;
}