#include using namespace std; int main() { int a, b; cin >> a >> b; for (int n = a; n <= b; n++) { if (n % 3 == 0) { cout << n << endl; } else { int t = n; while (t > 0) { if (t % 10 == 3) { cout << n << endl; break; } t /= 10; } } } return 0; }