{-# LANGUAGE ViewPatterns #-}
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Char

main = replicateM 3 B.getLine >>= B.putStrLn . solve 'a' . edit
    where
        edit (w : x : y : _) = (w, x, y)

solve :: Char -> (B.ByteString, B.ByteString, B.ByteString) -> B.ByteString
solve 'a' (B.uncons -> Just (x, xs), ys, zs) = solve x (xs, ys, zs)
solve 'b' (xs, B.uncons -> Just (y, ys), zs) = solve y (xs, ys, zs)
solve 'c' (xs, ys, B.uncons -> Just (z, zs)) = solve z (xs, ys, zs)
solve w _ = B.singleton $ toUpper w
