#include <iostream>
using namespace std;
int main()
{
char arr[3][3] = { {'o'} };
int count1 = 0, count2 = 0;
int count3 = 0, count4 = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cin >> arr[i][j];
}
}
for (int i = 0; i < 3; i++)
{
if (arr[i][0]=='K'&&arr[i][1]=='K'&&arr[i][2]=='K')
{
cout << "KiKi wins!" << endl;
return 0;
}
else if (arr[i][0] == 'B' && arr[i][1] == 'B' && arr[i][2] == 'B')
{
cout << "BoBo wins!" << endl;
return 0;
}
else if (arr[0][i] == 'K' && arr[1][i] == 'K' && arr[2][i] == 'K')
{
cout << "KiKi wins!" << endl;
return 0;
}
else if (arr[0][i] == 'B' && arr[1][i] == 'B' && arr[2][i] == 'B')
{
cout << "BoBo wins!" << endl;
return 0;
}
else if (arr[i][i] == 'K')
{
count1++;
}
else if (arr[i][i] == 'B')
{
count2++;
}
}
if (count1 != 3 || count2 != 3)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (i + j == 2)
{
if (arr[i][j] == 'K')
{
count3++;
}
else if (arr[i][j] == 'B')
{
count4++;
}
}
}
}
}
if (count1 == 3 || count3 == 3)
{
cout << "KiKi wins!" << endl;
}
else if (count2 == 3 || count4 == 3)
{
cout << "BoBo wins!" << endl;
}
else
{
cout << "No winner!" << endl;
}
return 0;
}
using namespace std;
int main()
{
char arr[3][3] = { {'o'} };
int count1 = 0, count2 = 0;
int count3 = 0, count4 = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cin >> arr[i][j];
}
}
for (int i = 0; i < 3; i++)
{
if (arr[i][0]=='K'&&arr[i][1]=='K'&&arr[i][2]=='K')
{
cout << "KiKi wins!" << endl;
return 0;
}
else if (arr[i][0] == 'B' && arr[i][1] == 'B' && arr[i][2] == 'B')
{
cout << "BoBo wins!" << endl;
return 0;
}
else if (arr[0][i] == 'K' && arr[1][i] == 'K' && arr[2][i] == 'K')
{
cout << "KiKi wins!" << endl;
return 0;
}
else if (arr[0][i] == 'B' && arr[1][i] == 'B' && arr[2][i] == 'B')
{
cout << "BoBo wins!" << endl;
return 0;
}
else if (arr[i][i] == 'K')
{
count1++;
}
else if (arr[i][i] == 'B')
{
count2++;
}
}
if (count1 != 3 || count2 != 3)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (i + j == 2)
{
if (arr[i][j] == 'K')
{
count3++;
}
else if (arr[i][j] == 'B')
{
count4++;
}
}
}
}
}
if (count1 == 3 || count3 == 3)
{
cout << "KiKi wins!" << endl;
}
else if (count2 == 3 || count4 == 3)
{
cout << "BoBo wins!" << endl;
}
else
{
cout << "No winner!" << endl;
}
return 0;
}