#include int main(void){ int A, B; scanf("%d%d", &A, &B); while(A != B){ if(A % 3 == 0){ printf("%d\n", A); } else if(A % 10 == 3 || A / 10 == 3){ printf("%d\n", A); } A++; } return 0; }