#!/usr/bin/ruby                                                                                                                                   
# -*- coding: utf-8 -*-                                                                                                                           

cup = {:a=>true, :b => false, :c => false}
while s = gets
  shuffle = s.chomp.split(',').each do|c|
    c.downcase!
  end
  cup[shuffle[0]],cup[shuffle[1]] = cup[shuffle[1]],cup[shuffle[0]]
end
puts cup.select {|k, v| v}.keys[0].upcase