#include using namespace std; bool isContainedThree(long long num) { while (num != 0) { if (num%10 == 3) { return true; } num /= 10; } return false; } int main(){ long long a,b; cin >> a >> b; for (long long i=a; i<=b; i++) { if (i%3 == 0) { cout << i << endl; } else if (isContainedThree(i)) { cout << i << endl; } } return 0; }