Yet Another Goat in the Garden

Problem Name:
Yet Another Goat in the Garden
Site:CodeForces
Links:
Tags:
Problem setters: