<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_fam(file_name):
 """Reads the FAM file to gather sample names. :param file_name: the ``fam`` file to read. :type file_name: str :returns: a :py:class:`dict` containing the gender of each samples. It uses the :py:func:`encode_gender` to encode the gender from ``1``and ``2`` to ``Male`` and ``Female``, respectively. """

    sample_names_gender = None
    with open(file_name, 'r') as input_file:
        sample_names_gender = dict([
            (i[1], encode_gender(i[4])) for i in [
                j.rstrip("\r\n").split(" ") for j in input_file.readlines()
            ]
        ])
    return sample_names_gender