قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " إِذَا أُكْرِهَ الاثْنَانِ عَلَى الْيَمِينِ فَاسْتَحَبَّاهَا، فَأَسْهِمْ بَيْنَهُمَا "
And the Messenger of Allah, peace and blessings be upon him, said: "When two men are compelled to take an oath and both of them prefer to take the oath, then cast lots between them."
Related hadith on this topic