import java.util.Scanner; public class Yuki207 { public static void main(String args[]){ Scanner scan = new Scanner(System.in); long begin = scan.nextLong(); long end = scan.nextLong(); for(long i = begin; i <= end; i++){ if(i % 3 == 0 || i % 10 == 3 || i / 10 == 3){ System.out.println(i); } } } }