import java.util.Scanner; class main{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); int A = scan.nextInt(); int B = scan.nextInt(); for(int i = A; i <= B; i++){ if(i % 3 == 0){ System.out.println(i); } else{ int num = i; while(true){ if(num % 10 == 3){ num = num / 10; System.out.println(i); break; } else{ num = num / 10; if(num == 0){ break; } } } } } } }