#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio( false );

	vector<bool> cup { true, false, false };
	char a, b, c;

	while( cin >> a >> c >> b ) {
		swap( cup[a - 'A'], cup[b - 'A'] );
	}

	for( int i = 0; i < 3; ++i ) {
		if( cup[i] ) {
			cout << (char)('A' + i) << endl;
		}
	}

	return 0;
}

