module Main where import Control.Applicative import Control.Monad nabeatsu :: Integer -> Bool nabeatsu n | n `mod` 3 == 0 = True | any (== '3') (show n) = True | otherwise = False main :: IO () main = do [a, b] <- fmap read . words <$> getLine mapM_ print (filter nabeatsu [a .. b])