import java.util.Scanner; public class Main{ public static void main (String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); String iPlusAToString; for(int i=1; i<=B-A+1; i++){ iPlusAToString = String.valueOf(i+A); if((i+A)%3 == 0 &&(i+A < B)){ System.out.println(i+A); }else if(iPlusAToString.contains("3") &&(i+A < B) ) { System.out.println(i+A); } } } }