A,B = map(int, raw_input().split()) for i in range(A, B+1): if i % 3 == 0: print i continue j = i ok = False while 0 < j: if j % 10 == 3: ok = True j /= 10 if ok: print i