On the exchange, orders get executed on a ‘first come first serve’ basis. (queue system)

This means that if multiple bids are placed at the exact same price, and there is only one offer to counter it, the execution will happen for the person who placed the bid first.

Ie, it follows a "price-time priority" principle for both orders and quotes. Whenever an order is placed at any exchange, it's given a timestamp which is then used to prioritize your orders.