#include<iostream>
#include<algorithm>
#include<utility>
using namespace std;
int main(){
  int a = 1;
  int b = 2;
  int c = 3;
  int x,y,A,B,C,tmp;
  while(cin >> x >> y){
    if(x == A && y == B || x == B && y == A){
        tmp = a;
        a = b;
        b = tmp;
    }
    if(x == C && y == B || x == B && y == C){
        tmp = c;
        c = b;
        b = tmp;
    }
    if(x == C && y == A || x == A && y == C){
	tmp = c;
        c = a;
        a = tmp;
    }
  }
  if(a = 1){
    cout << "A" << endl;
  }
  if(b = 1){
    cout << "B" << endl;
  }    
  if(c = 1){
    cout << "C" << endl;
  }  
return 0;
  }

