#include<iostream>

using namespace std;

int main() {
  int a[] = {1, 0, 0};
  string str;
  while (cin >> str) {
    swap(a[str[0] - 'A'], a[str[2] - 'A']);
  }
  for (int i = 0; i < 3; ++i) if (a[i] == 1) cout << (char)('A' + i) << endl;
  return 0;
}