The ants and the aphids live together happily in a very large land. But another insect,
ladybug, also lives in this land and brings great danger to the other two. One task of
the ants is driving the ladybugs away.
We number the n ants with 1, 2 , … n. Wherever the ladybugs is sitting, the ants’
actions are following those principles:
1) All the ants will choose a shortest path moving to the ladybug, and the ants can
move only one step to the adjacent points (only forwards, backwards, left, right)
at one time.
2) The ant whose path is the shortest will be the attacker who can move to ladybug.
If there is a tie the smaller numbered ant is the attacker. While the attacker
moves to the ladybug, the others will keep unmoved.
But after the ladybug has been driven away, it will fly back to another square. So the
ants will continue their job.
Now your task is giving you the initial positions of the ants and the position of
every time the ladybug sitting in, can you tell me the final positions of the ants.
And you should also need to tell how many times each ant drives the ladybug away from the