if not prod1 in visited:
    heapq.heappush(heap, (-prod1, x - 1, y))
visited[prod1] = True
if not prod2 in visited:
    heapq.heappush(heap, (-prod2, x, y - 1))
visited[prod2] = True

def main():
    for tup in mult_comb(10):
        print(tup)
if __name__ == '__main__':
    main()
Алгоритм мультипликативной комбинации