there is a bug in the matching algorithm, manifested at test111, but this bug does not affect the overall strategy