let ss = Array.init 3 @@ fun _ -> read_line ()
let i_s = Array.make 3 0
let j = ref 0
let _ =
  while i_s.(!j) < String.length ss.(!j) do
    let j1 = Char.code ss.(!j).[i_s.(!j)] - Char.code 'a' in
    i_s.(!j) <- i_s.(!j) + 1;
    j := j1
  done;
  Char.chr @@ Char.code 'A' + !j |> Printf.printf "%c\n"