solve 'Ant On Graph'