a,b = input().split(); j = i = 0; for i in range(int(a),int(b)): j = i; if (i%3 == 0): print(i); else: while(j > 10): if (j%10 == 3): print(i); j = j/10;