The situation you're proposing is an over-simplification that wouldn't occur in practice. Orders occur in a sequence over time. Time is an important part of the order matching process.
Orders are not processed in parallel; otherwise, the problem of fairness, already heavily regulated, would become even more complex.
First, crossed and locked markets are forbidden by regulators. Crossed orders are where one exchange has a higher bid than another's ask, or a lower ask than another's bid. A locked market is where a bid on one exchange is equal to the ask on another. HFTs would be able to make these markets because of the gap between exchange fees.
Since these are forbidden, and handling orders in parallel would ensure that a crossed or locked market would occur, orders are serialized (queued up), processed in order of price-time priority.
So, the first to cross the market will be filled with the best oldest opposing order.
Regulators believe crossed or locked markets are unfair. They would however eliminate the bid ask spread for many large securities thus the bid-ask cost to the holder.