first=input() # 読み込んだ文字列をスペースで分割する split_first = first.split() # それぞれをint型に変換する A = int(split_first[0]) B = int(split_first[1]) list_num=[] C=0 for i in range(A,B+1): #print(i) if i%3==0 and i!=0: list_num.append(i) C+=1 if int(i/10)==3 and i!=0: list_num.append(i) C+=1 if i%10==3 and i!=0: list_num.append(i) C+=1 #print(list_num) test=sorted(set(list_num)) for i in test: print(i)