def path_to_DNA_read_pairs(path: list, dist: int) -> str:
    """Convert a path of substrings to a condensed string

    :param path: the ordered path of substring pairs
    :type path: list (of tuples (of strs))
    :param dist: the distance between the read-pairs
    :type dist: int
    :returns: the overall string
    :rtype: str
    :raises: ValueError if path is invalid
    """

    prefix = path[0][0][:-1]
    suffix = path[0][1][:-1]
    for pair in path:
        prefix += pair[0][-1]
        suffix += pair[1][-1]
    prefix_len = len(prefix)
    pat_len = len(path[0][0])
    for i in range(dist + pat_len + 1, prefix_len):
        if prefix[i] != suffix[i - dist - pat_len - 1]:
            raise ValueError('Path not compatible')
    return prefix + suffix[prefix_len - dist - pat_len -1:]