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