def class_folder_tex(f, b_matrix, d_matrix):
    """
    Wirte in latex file 3 highest values of brwosing and diversifying matrices
    """
    f.write('\n% 7. Diversifying patterns according to folder classification')
    digit_dic = {'0': 'Zero', '1': 'One', '2': 'Two', '3': 'Three', '4':
        'Four', '5': 'Five', '6': 'Six', '7': 'Seven', '8': 'Eight', '9':
        'Nine'}
    i = 0
    for row in b_matrix.itertuples():
        i += 1
        f.write('\n\\newcommand{\\%s}{%s}' % ('FolderBP%sName' % digit_dic[
            str(i)], '%s$\\rightarrow$%s' % (row.folder_origin, row.
            folder_destination)))
        f.write('\n\\newcommand{\\%s}{%0.1f}' % ('FolderBP%sValue' %
            digit_dic[str(i)], 100.0 * row.data))
    i = 0
    for row in d_matrix.itertuples():
        i += 1
        f.write('\n\\newcommand{\\%s}{%s}' % ('FolderDP%sName' % digit_dic[
            str(i)], '%s$\\rightarrow$%s' % (row.folder_origin, row.
            folder_destination)))
        f.write('\n\\newcommand{\\%s}{%0.1f}' % ('FolderDP%sValue' %
            digit_dic[str(i)], 100.0 * row.data))
    return f
