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

void solve(int[] table) {
  auto answer =
    ['A': [1, 11, 10],
     'B': [10, 20, 30],
     'C': [1, 2, 3],
     'D': [10, 9, 19],
     'E': [1, 11, 12],
     'F': [10, 11, 21],
     'G': [1, 10, 9],
     ];
  foreach(i; 1..9) {
    foreach(j; 1..9) {
      int curr = i + j * 10;
      if (table[curr] == 1) {
        foreach(char c, list; answer) {
          if (list.filter!((x) => table[x + curr] == 1).array.length == 3) {
            writeln(c); break;
          }
        }
      }
    }
  }
}

void main() {
  while(true) {
    int[] table;
    table ~= repeat(0).take(10).array;
    foreach(i; 0..8) {
      table ~= [0] ~ readln().chomp.array.map!((x) => x.to!(int) - '0').array ~  [0];
    }
    table ~= repeat(0).take(10).array;
    solve(table);
    if (readln().length == 0) break;
  }
}