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