Breadth First Search (BFS) in Python