#include<iostream>

using namespace std;

int main(){
    int lot[3]={1,0,0};
    int a,b;
    while((cin>>a).ignore()>>b){
        swap(lot[a],lot[b]);
    }
            if(lot[0]==1)
                cout<<"A"<<endl;
    if(lot[1]==1)
        cout<<"B"<<endl;
    if(lot[2]==1)
        cout<<"C"<<endl;
    return 0;
}