#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; int main() { ll a, b; cin >> a >> b; for (ll i = a; i <= b; i++) { string s = to_string(i); if (i % 3LL == 0LL) cout << i << '\n'; else if (find(s.begin(), s.end(), '3') != s.end()) cout << i << '\n'; } return 0; }