#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	int a[3]={1,0,0};
	char cha1,cha2,buf;
	int i,j,t;

	while(scanf("%c,%c%c",&cha1,&cha2,&buf)!=EOF){
		i=cha1-'A';
		j=cha2-'A';
		t=a[i];
		a[i]=a[j];
		a[j]=t;
	}

	for(i=0;i<3;i++)
		if(a[i]==1){
			printf("%c\n",i+'A');
		}
	return 0;
}