#include <iostream>
using namespace std;


int main()
{
	char a, b, c;
	bool A = true;
	bool B = false;
	bool C = false;
	while (cin >> a >> b >> c)
	{
		if (a == A && c == B || a == B && c == A)
		{
			if (A == true && B == false)
			{
				A = false;
				B = true;
			}
			if (A == false && B == true)
			{
				A = true;
				B = false;
			}
		}
		if (a == A && c == C || a == C && c == A)
		{
			if (A == true && C == false)
			{
				A = false;
				C = true;
			}
			if (A == false && C == true)
			{
				A = true;
				C = false;
			}
		}
		if (a == B && c == C || a == C && c == B)
		{
			if (B == true && C == false)
			{
				B = false;
				C = true;
			}
			if (B == false && C == true)
			{
				B = true;
				C = false;
			}
		}
	}
	if (A)
	{
		cout << "A" << endl;
	}
	if (B)
	{
		cout << "B" << endl;
	}
	if (C)
	{
		cout << "C" << endl;
	}

	return 0;
}
