import java.util.Scanner; public class Main{ public static void main(String args[])throws Exception{ Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); for(int i=A;i<=B;i++){ if(i%3==0||contain3(i)){ System.out.println(i); } } } private static boolean contain3(int i) { while(i>1){ if(i%10==3){ return true; } i/=10; } return false; } }