Bfs Algorithm Python Simple Problems