#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; REP(i, b - a + 1) { int ai = a + i; int t = ai; if ((ai) % 3 == 0) { ans.push_back(ai); continue; } REP(i, t) { if (t % 10 == 3) ans.push_back(ai); t /= 10; } } if (SZ(ans) == 0) { return 0; } else { REP(i, SZ(ans)) { cout << ans[i] << endl; } } return 0; }