Noble Knight's Path

CodeForces - 226E