A, B = gets.split.map(&:to_i) ans = (A..B).select {|n| n % 3 == 0 or n.to_s.include?('3')} puts ans