breadth first solution to bacon number