pt = {
  '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]]
}

def pt_match(b, p, x, y, h, w)
	for dx in 0 .. (w-1)
		xx = x + dx
		if xx >= 8 then
			return false
		end
		for dy in 0 .. (h-1) do
			yy = y + dy
			if yy >= 8 then
				return false
			end

			if b[yy][xx] != p[dy][dx] then
				return false
			end
		end
	end

	return true
end

def mv_pat(b, p, h, w)
	x = 0
	while x <= (8 - w) do
		y = 0
		while y <= (8 - h) do
			if pt_match(b, p, x, y, h, w) then
				return true
			end
			y += 1
		end
		x += 1
	end
	return false
end

loop {
	b = []
	8.times {
		if (line = gets) == nil then
			exit
		end
		b.push line.chomp.split('').map(&:to_i)
	}

	pt.each { | key, d |
		h = d.size
		w = d[0].size

		if mv_pat(b, d, h, w) then
			puts key
			break
		end
	}

	if gets == nil then
		break
	end
}