import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int start = Integer.parseInt(sc.next()); int end = Integer.parseInt(sc.next()); boolean printFlg = false; for (int i = start; i <= end; i++) { String toStr = Integer.toString(i); for (int j = 0; j < toStr.length(); j++) { if (toStr.charAt(j) == '3') { printFlg = true; break; } } if (i % 3 == 0) { printFlg = true; } if (printFlg) { System.out.println(i); } printFlg = false; } } }