package yukicoder; import java.util.Scanner; public class Yuki3 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long a = scan.nextLong(); long b = scan.nextLong(); scan.close(); for(long i= a; i <= b; i++) { if(i % 3 == 0 || digit(i) == true){ System.out.println(i); } } } static private boolean digit(long num) { while(num>0){ long k1 = num %10; if (k1 == 3){ return true; } num = num/10; } return false; } }