the Messenger of Allah (ﷺ) said: “If a product is sold to two men, it is for the one who was first.”
Sunan Ibn Majah Book 13, Hadith 37