# -*- coding: utf-8 -*- def find_three(x): if x % 10 == 3: return x elif x >= 10: if find_three(x / 10) == 3: print x else: return None A, B = map(int, raw_input().split()) while(A <= B): if A % 3 == 0: print A else: find_three(A) A += 1