<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_bim(file_name):
 """Reads the BIM file to gather marker names. :param file_name: the name of the ``bim`` file. :type file_name: str :returns: a :py:class:`dict` containing the chromosomal location of each marker on the sexual chromosomes. It uses the :py:func:`encode_chr` to encode the chromosomes from ``X`` and ``Y`` to ``23`` and ``24``, respectively. """

    marker_names_chr = None
    with open(file_name, 'r') as input_file:
        marker_names_chr = dict([
            (i[1], encode_chr(i[0]))
            for i in [
                j.rstrip("\r\n").split("\t") for j in input_file.readlines()
            ] if encode_chr(i[0]) in {23, 24}
        ])
    return marker_names_chr