#include<iostream>
using namespace std;

void swap(int* x, int* y)
{
	int *z = x;
	x = y;
	y = z;

}

int main()
{
	int a[3] = { 1, 0, 0 };
	char x, y;
	char d;

	while (cin >> x >> d >> y){
		swap(&a[x - 'A'], &a[y - 'A']);
	}

	for (int i = 0; i < 3; ++i)
	if (a[i] == 1)
		cout << static_cast<char>('A' + i) << endl;


	return 0;
}