import Data.Monoid import Data.Foldable import Control.Applicative import Prelude hiding (elem,mapM_) import Data.Text hiding (take,filter) check::Int->Bool check = getAny.(Any.(elem '3').show<>Any.(==0).(`mod` 3)) readData::IO [Int] readData = fmap (read.unpack)<$>take 2.split (==' ').pack<$>getLine makeList::Enum a=>[a]->[a] makeList = (.(!! 1)).enumFromTo.(!! 0) <*> id main = readData >>=((flip forM_) (putStrLn.show).filter check.makeList)