#include<stdio.h>
#define BOMB 9
void hyouji(int ar[4][4]);
int main(void)
{
	int masu[4][4]={0};
	int x,y,count;
	
	masu[3][3]=BOMB;
	
	for(count=1;count<16;count++){
		while(1){
			printf("(%d回目)座標を選んでください(0～3)\nx:",count);
			scanf("%d",&x);
			printf("y:");
			scanf("%d",&y);
			if((x < 0 || x > 3) || (y < 0 || y > 3)){
				printf("0～3の範囲で入力してください\n"); 
				continue;
			}
			if(masu[y][x]==0 || masu[y][x]==BOMB) break;
			else printf("そこは一度選んでいます\n");
		}
		if(masu[y][x]==BOMB)break;
		masu[y][x]=1;
		hyouji(masu);
	}
	if(count<16)printf("wham!\n");
	else printf("You Win!!\n");
}

void hyouji(int ar[4][4])
{
	int x,y;
	for(y=0;y<4;y++){
		for(x=0;x<4;x++){
			if(ar[y][x]==BOMB) printf("0 ");
			else printf("%d ",ar[y][x]);
		}
		printf("\n");
	}
}