TreeMap for exact distance queries