trim
A* search