package yukicoder; import java.util.Scanner; public class Yukicoder { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); boolean D = false; for (int i = A; i <= B; i++) { String j = String.valueOf(i); String[] strArray = new String[j.length()]; for (int m = 0; m < j.length(); m++) { String str2 = String.valueOf(j.charAt(m)); strArray[m] = str2; int a = Integer.valueOf(strArray[m]); if (a == 3) { D = true; break; } } if (D == true || (i % 3) == 0) { System.out.println(i); } D = false; } } }