#include <bits/stdc++.h>
using namespace std;
int ar[4];
string s[4];
char b;
inline void input() {
  for (int i = 0; i < 4; i++) {
    cin >> s[i];
    ar[i] = s[i].size() - 2;
  }
}
int lon(int a) {
  for (int i = 0; i < 4; i++) {
    if (a != i) {
      if (ar[a] < (ar[i] * 2)) return 0;
    }
  }
  if (b >= 'A' && b <= 'D') {
    b = 'C';
    cout << 'C';
    return 1;
  }
  b = 'A' + a;
}
int sho(int a) {
  for (int i = 0; i < 4; i++) {
    if (a != i) {
      if (ar[a] > (ar[i] / 2)) return 0;
    }
  }
  if (b >= 'A' && b <= 'D') {
    b = 'C';
    cout << 'C';
    return 1;
  }
  b = 'A' + a;
}
int solve() {
  for (int i = 0; i < 4; i++) {
    if (lon(i) == 1) return 0;
    if (sho(i) == 1) return 0;
  }
  if (b <= 'D' && b >= 'A') {
    cout << b;
    return 0;
  }
  cout << 'C';
}
int main() {
  input();
  solve();
}
