Question: Example:

=MIN({"510";"515";"503";"";"";""})

How to get the min value of this array from **non-empty** items. Item *503* to be the minimum here and is the answer.

Answer: 
This problem is about creating [disjoint sets](https://en.wikipedia.org/wiki/Disjoint-set_data_structure) and so I would use union-find methods.

Now Python is not particularly known for being fast, but for the sake of showing the algorithm, here is an implementation of a `DisjointSet` class without libraries:

```
class DisjointSet:
    class Element:
        def __init__(self):
            self.parent = self
            self.rank = 0

    def __init__(self):
        self.elements = {}

    def find(self, key):
        el = self.elements.get(key, None)
        if not el:
            el = self.Element()
            self.elements[key] = el
        else: # Path splitting algorithm
            while el.parent != el:
                el, el.parent = el.parent, el.parent.parent
        return el

    def union(self, key=None, *otherkeys):
        if key is not None:
            root = self.find(key)
            for otherkey in otherkeys:
                el = self.find(otherkey)
                if el != root:
                    # Union by rank
                    if root.rank < el.rank:
                        root, el = el, root
                    el.parent = root
                    if root.rank == el.rank:
                        root.rank += 1

    def groups(self):
        result = { el: [] for el in self.elements.values() 
                          if el.parent == el }
        for key in self.elements:
            result[self.find(key)].append(key)
        return result

```

Here is how you could use it for this particular problem:

```
def solve(lists):
    disjoint = DisjointSet()
    for lst in lists:
        disjoint.union(*lst)

    groups = disjoint.groups()
    return [lst and groups[disjoint.find(lst[0])] for lst in lists]

```

Example call:

```
data = [
    [0, 5, 101],
    [8, 9, 19, 21],
    [],
    [78, 79],
    [5, 7, 63, 64]
]
result = solve(data)

```

The result will be:

```
[[0, 5, 101, 7, 63, 64], [8, 9, 19, 21], [], [78, 79], [0, 5, 101, 7, 63, 64]]

```

Note that I added an empty list in the input list, so to illustrate that this boundary case remains unaltered.

NB: There are libraries out there that provide union-find/disjoint set functionality, each with a slightly different API, but I suppose that using one of those can give a better performance.
Do you mean by?:

```
from itertools import combinations
l1 = [0, 5, 7, 63, 64, 101]
l2 = [8, 9, 19]
l3 = [78, 79]
l4 = [5, 4, 34]
print([v for x, y in combinations([l1, l2, l3, l4], 2) for v in {*x} & {*y}])

```

Output:

```
[5]

```