#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int main()
{
    char b1, b2, c;
    int t[3] = {1, 0, 0};

    while (scanf("%c,%c", &b1, &b2) != EOF){
        swap(t[b1 - 'A'], t[b2 - 'A']);
    }

    for (int i = 0; i < 3; i++){
        if (t[i] == 1)
            printf("%c\n", 'A' + i);
    }
    return 0;
}