#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;
int main(){

  bool cup[3]={true,false,false};
  int num[2];
  char n[2];
  char ssss;

  while(cin >> n[0] >> ssss >> n[1]){
    for(int i=0;i<2;i++)
      if(n[i] == 'A')
	num[i] = 0;
      else if(n[i] == 'B')
	num[i] = 1;
      else
	num[i] = 2;

    cup[num[1]] = !cup[num[1]];
    cup[num[0]] = !cup[num[0]];
  }

  for(int i=0;i<3;i++)
    if(cup[i] == true){
      if(i==0)
  	ssss = 'A';
      else if(i==1)
	ssss = 'B';
      else
	ssss = 'C';
      break;
    }

  cout << ssss << endl;

  return 0;
}