import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int low =sc.nextInt(); int hig =sc.nextInt(); for (int i=low;i<=hig;i++){ if ((i%3)==0){ System.out.println(i); }else if (String.valueOf(i).indexOf("3") >=0){ System.out.println(i); } } } }