# # #water_balloon - 장애물 역할 (함수)
# # #obstacle - 빠지면 죽음 (water_balloon)과 유사 (함수)
# # #player - Character Information 아래에 번호 매겨야 함 (정수 자료형)
# # map = [list(map(int, input().split()))for i in range(10)]
# # player = int(input())
# # a = []*player
# # for i in range(player):
# # a.append(input().split())
# #
# # def water_balloon(a, b):
# # global map
# # def obstacle(a, b):
# # global map
# #
# # for i in range(10):
# # for j in range(10):
# # if map[i][j]>0:
# # balloon = map[i][j]
# # map[i][j] = -2
# # for k in range(balloon):
# # if i+k>9 or map[i+k][j] == -1:
# # break
# # if map[i+k][j] == 0:
# # map[i+k][j] = -2
# # for k in range(balloon):
# # if i-k>10 or map[i-k][j] == -1:
# # break
# # if map[i-k][j] == 0:
# # map[i-k][j] = -2
# # for k in range(balloon):
# # if j-k>10 or map[i][j-k] == -1:
# # break
# # if map[i][j-k] == 0:
# # map[i][j-k] = -2
# # for k in range(balloon):
# # if j+k>10 or map[i][j+k] == -1:
# # break
# # if map[i][j+k] == 0:
# # map[i][j+k] = -2
# # for i in range(player):
# # if map[a[i][1]][a[i][2]]!=-2:
# # map[a[i][1]][a[i][2]] = i
# #
# #
# # for i in range(10):
# # for j in range(10):
# # print(map[i][j], end = ' ')
# # print()
# # print("Character Information")
# #
# # for i in range(player):
# # if map[x[i]][y[i]] == -2:
# # print("player ", i, " dead", sep = '')
# # else:
# # print("player ", i, " survive", sep = '')
#
#
# map = [list(map(int, input().split()))for i in range(10)]
# player = int(input())
# a = []*player
# for i in range(player):
# a.append(input().split())
# #____________________________________________________________________________입력
# # for i in range(player):
# # for j in range(player):
# # if map[i][j] > 0:
# # for k in range(map[i][j]):
# # map[i-k][j] = 1
# # map[i+k][j] = 1
# # map[i][j-k] = 1
# # map[i][j+k] = 1
# #
#
# print("Character Information")
# for i in range(player):
# if map[a[i][1]][a[i][2]] == 0:
# print("player", i, "survive", sep = ' ')
map = [list(map(int, input().split()))for i in range(1, 11)]
player = int(input())
a = []*player
for i in range(player):
a.append(input().split())
for i in range(10):
for j in range(10):
if map[i][j] > 0:
balloon = map[i][j]
map[i][j] = -2
for k in range(1, balloon + 1): #down
if i+k > 10 or map[i+k-1][j-1] == -1:
break
if map[i+k-1][j-1] == 0:
map[i+k-1][j-1] = -2
for k in range(1, balloon+1): #up
if i-k > 10 or map[i-k][j] == -1:
break
if map[i-k][j] == 0:
map[i-k][j] = -2
for k in range(1, balloon+1): #right
if j-k > 10 or map[i][j-k] == -1:
break
if map[i][j-k] == 0:
map[i][j-k] = -2
for k in range(1, balloon+1): #left :)
if j+k > 10 or map[i][j+k] == -1:
break
if map[i][j+k] == 0:
map[i][j+k] = -2
for i in range(player):
if map[a[i][1]][a[i][2]] != -2:
map[a[i][1]][a[i][2]] = i
for i in range(1, 10):
for j in range(1, 10):
print(map[i][j], end=' ')
print()
print("Character Information")
for i in range(1, player+1):
if map[a[i][1]][a[i][2]] == -2:
print("player", i, "dead", sep=' ')
else:
print("player", i, "survive", sep=' ')