#!/usr/bin/env python # -*- coding: utf-8 -*- def main(): numbers = input().split() min_num = int(numbers[0]) max_num = int(numbers[1]) num_list = [] for i in range(min_num,max_num): if i % 3 == 0: num_list.append(i) elif '3' in list(str(i)) : num_list.append(i) num_list = list(set(num_list)) num_list.sort() for j in num_list: print(j) if __name__ == '__main__': main()