import Control.Applicative main = do [a, b] <- map read . words <$> getLine mapM_ print $ filter (\x -> x `mod` 3 == 0 || '3' `elem` show x) [a..b]