Hungar wants to be a lord of her own world of Minecraft. At first she builds a main territory.
We assume the yellow territory is the King's. And blue ones are dukes', purple ones are marquis' while the gray ones are earls'.
And there're countless levels of title of nobility. One noble only have one superior, and his territory only have the direct roads between his direct superior's territory and direct inferior's.
After Hungar building such a world, she lets men in and allocations them territories.
Now the question is when a man wants to visit another one's territory, should he pass a territory that belongs a noble that has the same level with him?
For each case, you should count the number of that one will pass through a territories that equals his level.