#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std; 
int main(){
  char x,y,z;
  char P='A';
  while(cin>>x>>z>>y){
      
    if(x!='A'&&y!='A'){
      continue;
    }
    else if(x=='A'){
      P=y;
    }
    else if(y=='A'){
      P=x;
    }
  }
  cout<<P<<endl;
return 0;
}