Traveling Policy of Ajobdesh

Limits: 3s, 512 MB

In Ajobdesh, there are multiple cities and one of them is considered as “Capital City”. Obviously, King Hulala (the ruler of Ajobdesh) lives in the capital city. Each city is connected with its neighboring cities by single unidirectional roads. You can assume that the cost of traveling every road is equal, and it is considered as single unit.

This is a companion discussion topic for the original entry at
what is the problem with the code