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

void main(){

    bool[3] a;
    a[0] = true;
    a[1] = false;
    a[2] = false;
    while(true){
	auto s = readln();
	if(stdin.eof()) break;
	s = chomp(s);
	swap(a[to!int(s[0]-'A')],a[to!int(s[2]-'A')]);
    }
    for(int i=0;i<3;i++){
	if(a[i]) writeln(to!char(i + to!int('A')));
    }
}