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