breadth-first hack