Revert "not good"

This reverts commit 9a4e6c9a1587125989d2efe7ae4134b8a04c644a.
three "for" loop ,  queue may be better