<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collect_filters_to_first_location_occurrence(compound_match_query):
 """Collect all filters for a particular location to the first instance of the location. Adding edge field non-exsistence filters in `_prune_traverse_using_omitted_locations` may result in filters being applied to locations after their first occurence. OrientDB does not resolve this behavior correctly. Therefore, for each MatchQuery, we collect all the filters for each location in a list. For each location, we make a conjunction of the filter list (`_predicate_list_to_where_block`) and apply the new filter to only the first instance of that location. All other instances will have no filters (None). Args: compound_match_query: CompoundMatchQuery object containing 2^n MatchQuery objects Returns: CompoundMatchQuery with all filters for each location applied to the first instance of that location. """

    new_match_queries = []
    # Each MatchQuery has a different set of locations, and associated Filters.
    # Hence, each of them is processed independently.
    for match_query in compound_match_query.match_queries:
        # Construct mapping from location -> list of filter predicates applied at that location
        location_to_filters = _construct_location_to_filter_list(match_query)
        already_filtered_locations = set()

        new_match_traversals = []
        for match_traversal in match_query.match_traversals:
            result = _apply_filters_to_first_location_occurrence(
                match_traversal, location_to_filters, already_filtered_locations)
            new_match_traversal, newly_filtered_locations = result

            new_match_traversals.append(new_match_traversal)
            already_filtered_locations.update(newly_filtered_locations)

        new_match_queries.append(
            MatchQuery(
                match_traversals=new_match_traversals,
                folds=match_query.folds,
                output_block=match_query.output_block,
                where_block=match_query.where_block,
            )
        )

    return CompoundMatchQuery(match_queries=new_match_queries)