#include typedef long long Int; bool three(Int x){ while(x>0){ if(x%10==3){ return true; } x/=10; } return false; } int main(void){ Int i,a,b; scanf("%lld%lld",&a,&b); for(i=a; i<=b; i++){ if(i%3==0){ printf("%lld\n",i); }else if(three(i)){ printf("%lld\n",i); } } return 0; }