def swap(i,j)
  t = @out[i]
  @out[i] = @out[j]
  @out[j] = t
end

while g=gets
  @out = ["A","B","C"]
  g = g.chomp.split(/,/)
  for i in 0..1
    if g[i] == "A" then g[i]=0 end
    if g[i] == "B" then g[i]=1 end
    if g[i] == "C" then g[i]=2 end
  end
  swap(g[0],g[1])
end
puts @out[0]