solve a, but cost too much time. not solve b, TODO