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

cup = {:a => true, :b => false, :c => false}
while s = gets
  shuffle = s.chomp.split(',').map do|c|
    c.downcase
  end
  cup[shuffle[0].intern],cup[shuffle[1].intern] = cup[shuffle[1].intern],cup[shuffle[0].intern]
end

puts cup.select {|k, v| v}.keys[0].upcase