#include int main(void){ long int a,b; scanf("%ld",&a); scanf("%ld",&b); for(long int i = a; i <= b; i++){ if(i % 3 == 0)printf("%ld\n",i); else if(i % 10 == 3)printf("%ld\n",i); else{ for(long int j = i; j > 1; j /= 10){ if(j % 10 == 3){ printf("%ld\n",i); break; } } } } return 0; }