#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define SZ(a) (int)(a).size() #define FOR(i,a,b) for (int i=(a); i<=(b); ++i) #define REP(i,n) for (int i=0; i<(n); ++i) #define ALL(c) c.begin(), c.end() #define CLR(c,n) memset(c, n, sizeof(c)) #define MCPY(d, s) memcpy(d, s, sizeof(d)) #define TR(it, c) for (auto it = c.begin();it != c.end(); ++it) #define CONTAIN(it, c) (c.find(it) != c.end()) typedef vector VI; typedef pair PII; template void checkmin(T &a, T b) { if (b void checkmax(T &a, T b) { if (b>a) a=b; } typedef long long LL; const int INF=0x3F3F3F3F; bool check(int n) { if (n % 3 == 0) return true; while (n) { if (n % 10 == 3) return true; n /= 10; } return false; } int main(int argc, char *argv[]) { int a, b; while (cin >> a >> b) { FOR(i, a, b) if (check(i)) cout << i << endl; } }