A, B = map(int,input().split(' ')) for C in range(A, B + 1): if C % 3 == 0: print(C) elif str(3) in str(C): print(C)