#include <iostream>
int main(){
	char a,b,c;
	int x[3]={1,0,0};
	while (std::cin>>a>>c>>b){
		int i=a-'A', j=b-'A', k = x[i];
		x[i] = x[j];
		x[j] = k;
	}
	for (int i=0; i<3;i++)
		if (x[i]==1) std::cout<<char(i+'A')<<std::endl;
}