A,B=map(int,input().split()) flag=False for i in range(A,B+1): str_i=str(i) if '3' in str_i or i%3==0: print(i)