#include <iostream>
#include <algorithm>
using namespace std;
bool cup[3]={false};

int main(void){
	cup[0]=true;
	char a ,tmp ,b;
	while(true){
		cin >> a >> tmp >> b;
		if(cin.eof())
			break;
		swap(cup[a-'A'],cup[b-'A']);
	}
	char ans='A';
	for(int i=0;i<3;i++)
		if(cup[i])
			ans+=i;
	cout << ans << endl;
	return 0;
}