By first finding depth of each node using BFS, then selecting nodes with maximum depth, we can implement Dijsktra to find the path. Once you get the path, just look at the path for 15 seconds else you'll get WA. Then look at cats in path. Also look at hawks , snipers, terrorists as well, since they can easily kill a parrot.
Then do headshot snipers and use cats to kill the hawks.
After doing all this, use BrainF**k to submit your code
Have a nice Day