Manasa and the trail (HackerRank)