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