Sunan Abi Dawud 3957
Jabir said:
A man of the Ansar called Abu Madhkur declared that his slave called Ya'qub would be free after his death, but he had no other property. So the Messenger of Allah (ﷺ) called him and said: Who will buy him ? Nu'aim b. 'Abd Allah b. al-Nahham bought him for eight hundred dirhams. When he handed them over to him, he  (Prophet) said: If any of you is poor, he should begin from himself ; if anything is left over, give it to your family; if anything is left over, give it to your relatives ; if anything is left over (when they received something), then here and here.
حَدَّثَنَا أَحْمَدُ بْنُ حَنْبَلٍ، حَدَّثَنَا إِسْمَاعِيلُ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا أَيُّوبُ، عَنْ أَبِي الزُّبَيْرِ، عَنْ جَابِرٍ، أَنَّ رَجُلاً، مِنَ الأَنْصَارِ يُقَالُ لَهُ أَبُو مَذْكُورٍ أَعْتَقَ غُلاَمًا لَهُ يُقَالُ لَهُ يَعْقُوبُ عَنْ دُبُرٍ وَلَمْ يَكُنْ لَهُ مَالٌ غَيْرُهُ فَدَعَا بِهِ رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏"‏ مَنْ يَشْتَرِيهِ ‏"‏ ‏.‏ فَاشْتَرَاهُ نُعَيْمُ بْنُ عَبْدِ اللَّهِ بْنِ النَّحَّامِ بِثَمَانِمِائَةِ دِرْهَمٍ فَدَفَعَهَا إِلَيْهِ ثُمَّ قَالَ ‏"‏ إِذَا كَانَ أَحَدُكُمْ فَقِيرًا فَلْيَبْدَأْ بِنَفْسِهِ فَإِنْ كَانَ فِيهَا فَضْلٌ فَعَلَى عِيَالِهِ فَإِنْ كَانَ فِيهَا فَضْلٌ فَعَلَى ذِي قَرَابَتِهِ ‏"‏ ‏.‏ أَوْ قَالَ ‏"‏ عَلَى ذِي رَحِمِهِ فَإِنْ كَانَ فَضْلاً فَهَا هُنَا وَهَا هُنَا ‏"‏ ‏.‏