set and bfs