Build a map for ranges and prefixes.