import java.util.*; class No207{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); Long a = sc.nextLong(); Long b = sc.nextLong(); for (Long i = a; i <= b; i++){ if (i % 3 == 0){ System.out.println(i); } else { if (String.valueOf(i).indexOf("3") > -1) { System.out.println(i); } } } } }