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