f(p){for(;(p/=10)&&p%10-3;);return!p;}a;main(b){for(scanf("%d%d",&a,&b);a<=b;a++)a%3&&f(a)||printf("%d\n",a);}