#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
    char a, b;
    bool p[3] = { true, false, false };
    while( scanf( "%c,%c\n", &a, &b ) != -1 ) {
        swap( p[a-'A'], p[b-'A'] );
    }

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