class Game
  def initialize
    @cups = {A: true, B: false, C: false}
  end

  attr_accessor :cups

  def switch(one, another)
    tmp            = @cups[one]
    @cups[one]     = @cups[another]
    @cups[another] = tmp
  end

  def answer
    @cups.rassoc(true)[0]
  end
end

game = Game.new

while line = gets
  one, another = line.chomp.split(",").map(&:to_sym)
  game.switch(one, another)
end

puts game.answer