CodeForces - 802L Send the Fool Further! (hard)

NoSuchKey