import java.util.Scanner; public class renshu{ public static void main(String[] args){ Scanner kbs=new Scanner(System.in); int i,k,b; i=kbs.nextInt(); k=kbs.nextInt(); for(b=i;b<=k;b++){ if(b%3==0||Integer.toString(b).contains("3")){ System.out.println(b); } } System.out.println("\n"); } }