How to solve CHEFAFD ?

chefafd
dec16
graph
grid
solution

#1

Can someone explain how to solve CHEFAFD ? I can’t think of anything other than brute force for this.

Link : https://www.codechef.com/DEC16/problems/CHEFAFD