import Data.List
main = getContents >>= putStrLn.solve.lines
    where solve (x:y:_) | isInfixOf y (str y x) = "Yes"
                        | otherwise             = "No"
          str y = concat.(take (length y)).repeat