BFS,HashMap,AC