def match(data,sample,y,x)
    h = sample.length
    w = sample[0].length 
    return false if h+y > 8
    return false if w+x > 8
    for i in 0..h-1 do
        for j in 0..w-1 do
            return false if data[y+i][x+j]!=sample[i][j]
        end
    end
    true
end

while true
    data = Array.new
    for i in 0..8-1 do
        s = STDIN.gets.chomp
        data.push Array.new(8)
        for j in 0..8-1 do
            data[i][j] = s[j].to_i
        end
    end

    a = [[1,1], \
         [1,1]]
    b = [[1],\
         [1],\
         [1],\
         [1]] 
    c = [[1,1,1,1]]
    d = [[0,1],\
         [1,1],\
         [1,0]]
    e = [[1,1,0],\
         [0,1,1]]
    f = [[1,0],\
         [1,1],\
         [0,1]]
    g = [[0,1,1],\
         [1,1,0]]

    for i in 0..8-1 do
        for j in 0..8-1 do
            print "A\n" if match(data,a,i,j)
            print "B\n" if match(data,b,i,j)
            print "C\n" if match(data,c,i,j)
            print "D\n" if match(data,d,i,j)
            print "E\n" if match(data,e,i,j)
            print "F\n" if match(data,f,i,j)
            print "G\n" if match(data,g,i,j)
        end
    end


    exit 0 if not STDIN.gets
end