/*
ACSL Senior 5 Division
Lexington
High School
2012-2013
Contest #3
Brandon
Wong
*/
//#include
<string>
#include
<iostream>
#include
<vector>
int main()
{
for (int x=0; x<5; x++)
{
try{
std::cout<<(x==0?"":"\n")<<x+1<<".
";
std::vector<std::vector<int>>
board (8, std::vector<int> (8, 0));
std::vector<int> ndat
(2,-1);
int numpieces=0, fp=0;
while (ndat[0]!=0)
{
std::cin>>ndat[0]>>ndat[1];
if (ndat[0]!=0)
{
board[ndat[0]-1][ndat[1]-1]=1;
numpieces++;
}
}
for (int y=0; y<8; y++)
{
for (int z=0; z<8;
z++)
{
if
(board[y][z]!=1)
{
int ay=y,
az=z, pf=0;
while
(ay<8)
{
if
(board[ay][az]==1)
pf++;
ay++;
}
ay=y;
while
(ay>=0)
{
if
(board[ay][az]==1)
pf++;
ay--;
}
ay=y;
while
(az<8)
{
if
(board[ay][az]==1)
pf++;
az++;
}
az=z;
while
(az>=0)
{
if
(board[ay][az]==1)
pf++;
az--;
}
az=z;
while
(ay<8&&az<8)
{
if
(board[ay][az]==1)
pf++;
ay++;
az++;
}
ay=y;
az=z;
while
(ay>=0&&az>=0)
{
if
(board[ay][az]==1)
pf++;
ay--;
az--;
}
ay=y;
az=z;
while
(ay<8&&az>=0)
{
if
(board[ay][az]==1)
pf++;
ay++;
az--;
}
ay=y;
az=z;
while
(ay>=0&&az<8)
{
if
(board[ay][az]==1)
pf++;
ay--;
az++;
}
if
(pf==numpieces&&numpieces!=0)
{
std::cout<<y+1<<",
"<<z+1<<"";
fp=1;
y=8;
z=8;
}
}
}
}
if (fp==0)
std::cout<<"NONE";
}
catch(...){}
}
return 0;
}