import java.util.Scanner; public class world{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); long s = scan.nextLong(); long e = scan.nextLong(); for(long i = s; s<=e;i++){ if(String.valueOf(i).indexOf("3")>-1){ System.out.println(i); }else if(i%3==0){ System.out.println(i); } } } }