import java.io.BufferedReader; import java.io.InputStreamReader; public class No207 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); long[] a = strToLongArray(br.readLine()); long A = a[0]; long B = a[1]; for (long i = A; i <= B; i++) { if (i % 3 == 0 || Long.toString(i).contains("3")) { System.out.println(i); } } System.out.println(); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } static long[] strToLongArray(String S) { String[] strArray = S.split(" "); long[] longArray = new long[strArray.length]; for (int i = 0; i < strArray.length; i++) { longArray[i] = Long.parseLong(strArray[i]); } return longArray; } }