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