import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    immutable N = 8;
    immutable n = readln().chomp().to!int();
    foreach(i;0..n)
    {
        readln();
        auto m = iota(N).map!(_=>readln.chomp().to!(char[])()).array();
        immutable x = readln().chomp().to!int();
        immutable y = readln().chomp().to!int();
        void dfs(int x, int y)
        {
            if(x<0 || N<=x || y<0 || N<=y || m[y][x]=='0') return;
            m[y][x]='0';
            foreach(d;[[1,0],[-1,0],[0,1],[0,-1]])
                foreach(k;1..4)
                    dfs(x+d[0]*k,y+d[1]*k);
        }
        dfs(x-1,y-1);
        writeln("Data ",i+1,":");
        m.join("\n").writeln();
    }
}