#include<stdio.h>
int main(){
  int i;
  int data[3]={0};
  data[0]=1;
  char s1,s2;
  char tenn;
  while(scanf("%c",&s1)!=EOF){
    scanf("%c%c",&tenn,&s2);
    if(data[s1-'A']<data[s2-'A']){
      int temp;
      temp=data[s1-'A'];
    data[s1-'A']=data[s2-'A'];
    data[s2-'A']=temp;
    }
  }
  for(i=0;i<3;i++){
    if(data[i]==1){
      printf("%c\n",('A'+i));
    }
  }
  return(0);
}