finding valid route from given map