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