#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a[3] = {1, 0, 0};
  string s;
  while (cin >> s) {
    swap(a[s[0] - 'A'], a[s[2] - 'A']);
  }
  for (int i = 0; i < 3; i++) {
    if (a[i]) cout << (char)(i + 'A') << endl;
  }

  return 0;
}
