from itertools import product tr = {"буби": "бубен", "пики": "пик", "трефы": "треф", "черви": "червей"} card_type, card_num = tr[input()], input() types = ("бубен", "пик", "треф", "червей") nums = ("10", "2", "3", "4", "5", "6", "7", "8", "9", "валет", "дама", "король", "туз") count = 0 for elem in product(nums, types, repeat=3): f = True a, b, c = f"{elem[0]} {elem[1]}", f"{elem[2]} {elem[3]}", f"{elem[4]} {elem[5]}" if a == b or b == c or a == c: f = False if f and card_type in elem and card_num not in elem: print(a, b, c, sep=", ") count += 1 if count == 10: break