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 > 0): if (j % 10 == 3): print(j); j = j / 10;