def bomb(x,y):

    global M

    s=M[y+2]

    R=[-3,-2,-1,1,2,3]

    if s[x+2]=="0":return

    M[y+2]=s[:x+2]+"0"+s[x+3:]

    for d in R:

        bomb(x+d,y)

        bomb(x,y+d)

    return



A=list(range(14))

B=list(range(8))

M=["00000000000000" for i in A]

z="000"

n=eval(input())

for i in range(n):

    s=input()

    for j in B:

        M[j+3]=z+input()+z

    x=eval(input())

    y=eval(input())

    bomb(x,y)

    print("Data %d:" %(i+1))

    for j in B:

        print(M[j+3][3:-3])
def bomb(x,y):

    global M

    s=M[y+2]

    R=[-3,-2,-1,1,2,3]

    if s[x+2]=="0":return

    M[y+2]=s[:x+2]+"0"+s[x+3:]

    for d in R:

        bomb(x+d,y)

        bomb(x,y+d)

    return



A=list(range(14))

B=list(range(3,11))

M=["00000000000000" for i in A]

z="000"

n=eval(input())

for i in range(n):

    s=input()

    for j in B:

        M[j]=z+input()+z

    x=eval(input())

    y=eval(input())

    bomb(x,y)

    print("Data %d:" %(i+1))

    for j in B:

        print(M[j][3:-3])
def bomb(x, y):
    global M
    s = M[y + 2]
    R = [-3, -2, -1, 1, 2, 3]
    if s[x + 2] == "0":
        return
    M[y + 2] = s[: x + 2] + "0" + s[x + 3 :]
    for d in R:
        bomb(x + d, y)
        bomb(x, y + d)
    return


A = list(range(14))
B = list(range(8))
M = ["00000000000000" for i in A]
z = "000"
n = eval(input())
for i in range(n):
    s = input()
    for j in B:
        M[j + 3] = z + input() + z
    x = eval(input())
    y = eval(input())
    bomb(x, y)
    print("Data %d:" % (i + 1))
    for j in B:
        print(M[j + 3][3:-3])

def bomb(x, y):
    global M
    s = M[y + 2]
    R = [-3, -2, -1, 1, 2, 3]
    if s[x + 2] == "0":
        return
    M[y + 2] = s[: x + 2] + "0" + s[x + 3 :]
    for d in R:
        bomb(x + d, y)
        bomb(x, y + d)
    return


A = list(range(14))
B = list(range(3, 11))
M = ["00000000000000" for i in A]
z = "000"
n = eval(input())
for i in range(n):
    s = input()
    for j in B:
        M[j] = z + input() + z
    x = eval(input())
    y = eval(input())
    bomb(x, y)
    print("Data %d:" % (i + 1))
    for j in B:
        print(M[j][3:-3])

-B = list(range(8)) +B = list(range(3, 11)) -        M[j + 3] = z + input() + z +        M[j] = z + input() + z -        print(M[j + 3][3:-3]) +        print(M[j][3:-3])