a,b = gets.split a = a.to_i b = b.to_i for i in a .. b c = i%3 d = i.to_s if c == 0 || d.include?('3') puts i end end