#include<stdio.h>
int main(void){
int i,j,x,y,next;
int a[3][3]={{1,0,0},
{0,0,0},
{0,0,0}};
int b[3][3]={{12,20,10},
{2,-1, 0},
{2, 0, 1}};
int c[3][3]={{21,22,21},
{22,-1,20},
{12, 2,10}};
while(1){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
if(a[i][j]==0){ printf("□"); }
else{
x=i;
y=j;
printf("★");}
}
printf("\n");
}
for(i=0;i<3;i++){
for(j=0;j<3;j++){
if(a[i][j]==1) printf("(%d,%d)",b[i][j]/10,b[i][j]%10);
}
}
printf("\n");
for(i=0;i<3;i++){
for(j=0;j<3;j++){
if(a[i][j]==1) printf("(%d,%d)",c[i][j]/10,c[i][j]%10);
}
}
printf("\n next : ");
scanf("%d",&next);
if(next==b[x][y]){
a[x][y]=0;
a[b[x][y]/10][b[x][y]%10]=1;
}else if(next==c[x][y]){
a[x][y]=0;
a[c[x][y]/10][c[x][y]%10]=1;
}else if(next==-1)break;
}
return 0;
}