import std.stdio,std.string,std.conv,std.algorithm;

int main()
{
	string s;
	int a[3] = [1,0,0];
	while((s = readln.chomp).length != 0)
	{
		int d = s[0] - 'A';
		int d2 = s[2] - 'A';
		swap(a[d],a[d2]);
	}

	foreach(i;0..3)
	{
		if(a[i] == 1)
		{
			writeln(cast(char)(i + 'A'));
		}
	}
	return 0;
}