A, B = gets.split.map(& :to_i) for ans in A..B if ans % 3 == 0 || ans.to_s.index("3") puts ans end end