#include <iostream>
#include <cstdio>

using namespace std;

void swap(bool* x,bool* y){
    *x^=*y;
    *y^=*x;
    *x^=*y;
}

int main()
{
    char str[4];
    bool cap[3]={0};
    while(cin>>str)
    {
        cap[0]=1;
        if(str[0]=='A'&str[2]=='B'||str[2]=='A'&str[0]=='B')swap(cap,cap+1);
        if(str[0]=='A'&str[2]=='C'||str[2]=='A'&str[0]=='C')swap(cap,cap+2);
        if(str[0]=='B'&str[2]=='C'||str[2]=='B'&str[0]=='C')swap(cap+1,cap+2);
    }
    for(int i=0;i<3;++i){
            if(cap[i]){
                switch(i){
                    case 0: cout<<'A'<<endl;return 0;
                    case 1: cout<<'B'<<endl;return 0;
                    case 2: cout<<'C'<<endl;return 0;
                }
            }
        }
}