use std::io::*; use std::str::*; fn read(sl: &mut StdinLock) -> Option { let s = sl.by_ref().bytes().map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::(); s.parse::().ok() } fn run(sl: &mut StdinLock) { let a = read::(sl).unwrap(); let b = read::(sl).unwrap(); (a..(b+1)).filter(|n| { if (n % 3) == 0 { true } else { let mut r = *n; while r > 0 { if (r % 10) == 3 { break; } r /= 10; } r != 0 } }).for_each(|n| println!("{}", n)); } fn main() { let s = stdin(); let mut sl = s.lock(); run(&mut sl); }