build A..E hashes and solve distances backwards