main = do
    l <- getLine >>= return.words
    check l >>= putStrLn

check :: [String] -> IO String
check (x:y:xs)
    | elem x (y:xs) == True = check (y:xs ++ [x])
    | otherwise                    = return x