#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
void swap(int a[], int b, int c) {
  int t = a[b];
  a[b] = a[c];
  a[c] = t;
}
int main() {
  int a[3] = {1};
  char b, c;
  while (scanf("%c,%c", &b, &c) != EOF) {
    swap(a, b - 'A', c - 'A');
  }
  for (int i = 0; i < 3; i++) {
    if (a[i]) printf("%c\n", i + 'A');
  }
  return 0;
}