Sunan Ibn Majah, Book 23, Hadith 22 (Ibn Majah 2742)

It was narrated that Ibn ‘Abbas said:

“The Messenger of Allah (ﷺ) said: ‘Distribute wealth among those who are entitled to shares of inheritance, according to the Book of Allah, then whatever is left over goes to the nearest male relative.’”