#include <stdio.h>//크레이지 아케이드
int main()
{
int a[12][12]={};
char b[10]={};
int i,j,n,x,y,s;
for(i=1; i<=10; i++){
for(j=1; j<=10; j++){
scanf("%d",&a[i][j]);
}
}
/*for(i=1; i<=10; i++){
for(j=1; j<=10; j++){
printf("%2d ",a[i][j]);
}
printf("\n");
}*/
for(i=1; i<=10; i++){
for(j=1; j<=10; j++){
if(a[i][j]>0){
for(s=1; s<=a[i][j]; s++){
if(a[i+s][j]==-1){
break;
}
else if(a[i+s][j]==0){
a[i+s][j]=-2;
}
}
for(s=1; s<=a[i][j]; s++){
if(a[i-s][j]==-1){
break;
}
else if(a[i-s][j]==0){
a[i-s][j]=-2;
}
}
for(s=1; s<=a[i][j]; s++){
if(j+s>10 || a[i][j+s]==-1){
break;
}
else if(a[i][j+s]==0){
a[i][j+s]=-2;
}
}
for(s=1; s<=a[i][j]; s++){
if(j-s<1 || a[i][j-s]==-1){//범위 조절 j-s<1 4개 모두 확인
break;
}
else if(a[i][j-s]==0){
a[i][j-s]=-2;
}
}
a[i][j]=-2;
}
}
}
scanf("%d",&n);
for(i=1; i<=n; i++){
scanf("%d %d",&x,&y);
if(a[x][y]!=0){
//b[i] = "dead"; (x)
//strcpy(b[i],"dead");
b[i]='d';
}
else{
a[x][y]=i;
//strcpy(b[i],"survive");
b[i]='s';
}
}
for(i=1; i<=10; i++){
for(j=1; j<=10; j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
printf("Character Information\n");
for(i=1; i<=n; i++){
if(b[i]=='d'){
printf("player %d dead\n",i);
}
else{
printf("player %d survive\n",i);
}
}
return 0;
}