#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() using namespace std; typedef long long ll; typedef vector VI; int main() { int a, b; cin >> a >> b; VI ans; FOR(i, a, b) { if (i % 3 == 0) { ans.push_back(i); continue; } int t = i; while(t) { if (t % 10 == 3) ans.push_back(i); t /= 10; } } if (SZ(ans) == 0) { return 0; } else { REP(i, SZ(ans)) { cout << ans[i] << endl; } } return 0; }