BFS is faster while removing repetitions