#include using namespace std; typedef long long ll; typedef pair P; const int INF = 1e9; const int mod = 1e9+7; const double EPS = 1e-10; const double PI = acos(-1.0); int main() { int a,b; cin >> a >> b; for(int i = a; i <= b; i++){ if(i%3 == 0) cout << i << endl; else{ int tmp = i; while(tmp){ if(tmp%10 == 3){ cout << i << endl; break; } tmp /= 10; } } } return 0; }