Jabir bin Zaid (may Allah have mercy on him) said: A person was brought to Ziyad who had both organs (male and female), and it was not known how to allocate inheritance for him. So he said: "Who will solve this issue?" It was said: Jabir bin Zaid (may Allah have mercy on him. So he was called from prison, and he came walking in shackles. Ziyad said: "Decide." So he said: "Make him stand against the wall; if he urinates on the wall, he is a man, and if he urinates on his legs, she is a woman."
Hadith Referenceسنن سعید بن منصور / كتاب ولاية العصبة / 1298
Hadith Takhrij«أخرجه سعيد بن منصور فى «سننه» ترقيم الدرالسلفية برقم:، 121، 123، والبيهقي فى«سننه الكبير» برقم: 12642، 12643، وابن أبى شيبة فى «مصنفه» برقم: 32016»