a, b = gets.split.map(&:to_i) ans = [] (a..b).each do |x| ans << x if x % 3 == 0 || x.digits.include?(3) end puts ans