Accepted, bfs with pruning