import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class No207 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); List nums = new ArrayList<>(); for (int i = a; i <= b; i++) { if (i % 3 == 0) { nums.add(i); } else if (String.valueOf(i).indexOf("3") >= 0) { nums.add(i); } } Collections.sort(nums); for (int n : nums) { System.out.println(n); } sc.close(); } }