a,b = gets.split (a..b).each do |x| if x.count('3') > 0 || x.to_i % 3 == 0 puts x end end