#include int main(void) { int a, b, i, t, f; scanf("%d%d", &a, &b); for (i = a;i <= b;i++) { f = 0; if (i % 3 == 0) f = 1; else { for (t = i; t != 0; t /= 10) { if (t % 10 == 3) f = 1; } } if (f == 1) printf("%d\n", i); } return 0; }