
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 = j + i * 10;
      if (table[curr] == 1) {
        foreach(char c, list; answer) {
          bool ans = true;
          foreach(x; list) if ((x + curr) < table.length && table[x + curr] != 1) ans = false;
          if (ans) {writeln(c); break;}
        }
        goto end;
      }
    }
  }
 end:;
}

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);
    readln();
    if(stdin.eof()) break;
  }
}