def build_dictionary(chars):
    """
    Organizes data read from files in a dictionary
    :param chars: all chars read from files to learn
    :return: the dictionary
    """

    d = {}

    for key in chars:
        for c in chars[key]:
            if c[3] not in d:
                d[c[3]] = set(c[1])
            else:
                d[c[3]].add(c[1])

    return d