Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:12508Abū Bakr Aḥmad b. ʿAlī > Ibrāhīm b. ʿAbdullāh > Ismāʿīl b. Ibrāhīm > al-Ḥasan b. ʿĪsá > Ibn al-Mubārak > Maʿmar > al-Zuhrī > Suʾil > al-Majūs Idhā Aslamūā And Lahum Nasabān

[Machine] It is inherited by the closer one of them.  

البيهقي:١٢٥٠٨أَخْبَرَنَا أَبُو بَكْرٍ أَحْمَدُ بْنُ عَلِيٍّ أنا إِبْرَاهِيمُ بْنُ عَبْدِ اللهِ ثنا إِسْمَاعِيلُ بْنُ إِبْرَاهِيمَ ثنا الْحَسَنُ بْنُ عِيسَى أنا ابْنُ الْمُبَارَكِ ثنا مَعْمَرٌ عَنِ الزُّهْرِيِّ أَنَّهُ سُئِلَ عَنِ الْمَجُوسِ إِذَا أَسْلَمُوا وَلَهُمْ نَسَبَانٌ قَالَ

يُوَرَّثُ بِأَقْرَبِهِمَا