bfs, hashtable to store the previous path, recursively find all possible path