rank = []

for i in range(3):
  rank.append(list(map(int, input().split())))
  rank[i].append(i)
rank.sort(reverse=True)

for i in range(2):
  if rank[i][0] == rank[i+1][0]:
    if rank[i][1] > rank[i+1][1]:
      rank[i], rank[i+1] = rank[i+1], rank[i]

for i in range(3):
  if rank[i][2] == 0:
    print('A')
  elif rank[i][2] == 1:
    print('B')
  else:
    print('C')