Implement with BFS