#include using namespace std; int main(void){ int A, B, tmp; cin >> A >> B; while(A<=B){ if(!(A%3)) cout << A << endl; else{ for(tmp=A; tmp; tmp/=10) if(tmp%10 == 3){ cout << A << endl; break; } } A++; } return 0; }