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