a=gets.split.map(&:to_i) (a[0]..a[1]).each{|i|puts i if i%3==0||i.to_s.include?('3')}