import sys def main(): text = sys.stdin.readline() param = text.split(" ") nam_min = int(param[0]) nam_max = int(param[1]) nam_target = nam_min while nam_target <= nam_max: if nam_target % 3 == 0 : print(nam_target) elif str(nam_target).find("3") != -1: print(nam_target) nam_target += 1 if __name__ == "__main__": main()