search and pruning. similar with 014.