#include<iostream>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
int main(){
	map<string, int> cup;
	cup["A"] = 1;
	cup["B"] = 0;
	cup["C"] = 0;
	char c1, c2, delim;
	while( cin >> c1 >> delim >> c2 ){
		swap(cup['c1'] , cup['c2']);
	}
	if(cup["A"] == 1) cout << "A" << '?\n';
	if(cup["B"] == 1) cout << "B" << '?\n';
	if(cup["C"] == 1) cout << "C" << '?\n';
}