import re


def get_headers_pairs_list(filename, verbose=False):
    """
    Read data for clustering from a given file.

    Data format: <email_number> <header>.
    Clusters are separated with a blank line.

    :param filename: file with input data for clustering.
    :param verbose: Whether to be verbose. Default - False.
    :return: List of pairs (email_number, header).

    """

    if verbose:
        print("Reading headers...", end="")

    with open(filename, encoding='utf-8') as inf:
        lines = list(map(lambda x: x.strip(), inf.readlines()))
        lines = list(filter(lambda x: x != "", lines))

        def make_pair(line):
            words = re.split(re.compile("\s+"), line)
            return (
                int(words[0]),
                " ".join(words[1:])
            )

        if verbose:
            print("Done")

        return list(map(make_pair, lines))