import Prelude main :: IO () main = do [a, b] <- map read . words <$> getLine mapM_ print $ calc [a..b] calc :: [Int] -> [Int] calc = filter (\i -> (mod i 3 == 0) || elem '3' (show i))