import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int From = sc.nextInt();
        int End = sc.nextInt();
        
        for(int i=From;i<=End;From++){
            if (i%3==0){
                System.out.println(i);
            } else{
            //    String s = Integer.toString(i);
                String s_From = Integer.toString(i);
                if(s_From.contains("3")){
                    System.out.println("s_From");
                }  
            }
        }
    }
}