#include //#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //using namespace atcoder; using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>>; vector seen; bool C = true; vector dist; ll mod =1e9+7; int op(int a, int b) { return min(a, b); } int e() { return int(1e9); } int main() { ll A, B; cin >> A >> B; for (ll k = A; k <= B; k++) { if (k % 3 == 0)cout << k << endl; else { ll p = k; while (p > 0) { if (p % 10 == 3) { cout << k << endl; break; } p /= 10; } } } }