#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int data[3] = {1, 0, 0};
  char d, e, f;
  while (cin >> d >> e >> f)
    swap(data[int(d-'A')], data[int(f-'A')]);

  for (int i = 0; i < 3; ++i)
    if (data[i] == 1)
      cout << char(i + 'A') << endl;
}
