#include <deque>
#include <vector>
#include <iostream>
#include <cassert>

using namespace std;

template<typename T>
class matrix2d {
public:
	matrix2d(size_t width, size_t height) : width_(width), height_(height), data_(width*height, T()) {}

	T&       at(size_t x, size_t y)       { return data_[width_ * y + x]; }
	const T& at(size_t x, size_t y) const { return data_[width_ * y + x]; }

	size_t width()  const { return width_; }
	size_t height() const { return height_; }

private:
	size_t width_;
	size_t height_;
	deque<T> data_;
};

class block {
public:
	block(size_t width, size_t height, const char *blocks) : data_(width, height) {
		for (size_t y = 0; y < height; y++) {
			for (size_t x = 0; x < width; x++) {
				data_.at(x, y) = (blocks[width * y + x] == '1') ? 1 : 0;
			}
		}
		assert(blocks[width*height] == 0);
	}

	int&       at(size_t x, size_t y)       { return data_.at(x, y); }
	const int& at(size_t x, size_t y) const { return data_.at(x, y); }

	size_t width() const { return data_.width(); }
	size_t height() const { return data_.height(); }

private:
	matrix2d<int> data_;
};

class field {
public:
	field(size_t width, size_t height) : data_(width, height) {}

	int& at(size_t x, size_t y) { return data_.at(x, y); }

	bool contains(const block& b) const {
		for (int y = 0; y < data_.height(); y++) {
			for (int x = 0; x < data_.width(); x++) {
				if (x + b.width() > data_.width()) {
					break;
				}
				if (match(b, x, y)) {
					return true;
				}
			}
			if (y + b.height() > data_.height()) {
				break;
			}
		}
		return false;
	}

private:
	bool match(const block& b, int left, int top) const {
		for (int dy = 0; dy < b.height(); dy++) {
			for (int dx = 0; dx < b.width(); dx++) {
				if (data_.at(left + dx, top + dy) != b.at(dx, dy)) {
					return false;
				}
			}
		}
		return true;
	}

	matrix2d<int> data_;
};

typedef pair<block, char> block2name;

block2name make_block(const char* data, size_t width, size_t height, char name) {
	return make_pair(block(width, height, data), name);
}

int main(void) {
	vector<block2name> blocks;

	blocks.push_back(make_block(
		"11"
		"11", 2, 2, 'A'));

	blocks.push_back(make_block(
		"1"
		"1"
		"1"
		"1", 1, 4, 'B'));

	blocks.push_back(make_block(
		"1111", 4, 1, 'C'));

	blocks.push_back(make_block(
		" 1"
		"11"
		"1 ", 2, 3, 'D'));

	blocks.push_back(make_block(
		"11 "
		" 11", 3, 2, 'E'));

	blocks.push_back(make_block(
		"1 "
		"11"
		" 1", 2, 3, 'F'));

	blocks.push_back(make_block(
		" 11"
		"11 ", 3, 2, 'G'));

	while (!cin.eof()) {
		field f(8, 8);
		char c;	
		for (int y = 0; y < 8; y++) {
			for (int x = 0; x < 8; x++) {
				cin >> c;
				f.at(x, y) = (c == '1') ? 1 : 0;
			}
		}

		for (int i = 0; i < blocks.size(); i++) {
			if (f.contains(blocks[i].first)) {
				cout << blocks[i].second << endl;
				break;
			}
		}
	}
}