#include int main(void) { unsigned long a,b,tmp; scanf("%lu %lu",&a,&b); for (;a<=b;a++) { if (a%3==0) { printf("%lu\n",a); continue; } for (tmp=a;tmp>0;tmp/=10) { if (tmp%10==3) { printf("%lu\n",a); break; } } } return 0; }