import heapq


class Node:
    def __init__(self, value, list_num, index):
        self.value = value
        self.list_num = list_num
        self.index = index

    def __lt__(self, other):
        return self.value < other.value


def smallest_range(arrays):
    if not arrays or any(len(arr) == 0 for arr in arrays):
        return None

    min_heap = []
    current_max = float("-inf")

    for list_num, arr in enumerate(arrays):
        value = arr[0]
        heapq.heappush(min_heap, Node(value, list_num, 0))
        if value > current_max:
            current_max = value

    best_start = min_heap[0].value
    best_end = current_max

    while len(min_heap) == len(arrays):
        smallest = heapq.heappop(min_heap)
        current_min = smallest.value

        if current_max - current_min < best_end - best_start:
            best_start = current_min
            best_end = current_max

        next_index = smallest.index + 1
        source_list = arrays[smallest.list_num]

        if next_index >= len(source_list):
            break

        next_value = source_list[next_index]
        heapq.heappush(min_heap, Node(next_value, smallest.list_num, next_index))

        if next_value > current_max:
            current_max = next_value

    return [best_start, best_end]