def invert_claims(claims):
    """Convert a dict of {claim_number: claims} to {(x, y): {claim_numbers}}"""
    coordinates_claimed = {}
    for claim_number, coordinate_set in claims.items():
        for coordinates in coordinate_set:
            try:
                coordinates_claimed[coordinates].append(claim_number)
            except KeyError:
                coordinates_claimed[coordinates] = [claim_number]
    return coordinates_claimed