Who makes the sale on two differing sell orders?

Party A creates a sell order of one share of xyz for $12. Party B creates a sell order at the same moment in time for one share of xyz at $11. Party C

Party A creates a sell order of one share of xyz for $12. Party B creates a sell order at the same moment in time for one share of xyz at $11. Party C makes a bid of $12 for one share of xyz. Does party A or party B get to complete the transaction?

or:Party A creates a sell order of one share of xyz for $12. Party B creates a sell order at the same moment in time for one share of xyz at $11. Party C makes a bid of $12 for one share of xyz. Does party A or party B get to complete the transaction?

Tags:sale,moment,sell,