#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> #include <stack> #include <algorithm> #include <string> #include <map> #include <iterator> #include <set> #include <queue> using namespace std; bool contain3(long long int n) { string s = to_string(n); for (int i = 0; i < s.size(); ++i) { if (s[i] == '3') { return true; } } return false; } int main() { long long int A, B; cin >> A >> B; for (long long int i = A; i <= B; ++i) { if (i % 3 == 0 || contain3(i)) { cout << i << endl; } } return 0; }