Sunan an-Nasa'i, Book 27, Hadith 44 (In-Book)

It was narrated from 'Aishah that the Prophet said: "The pen has been lifted from three: From the sleeper until he wakes up, from the minor until he grows up, and from the insane until he comes back to his senses or recovers."

أَخْبَرَنَا يَعْقُوبُ بْنُ إِبْرَاهِيمَ، قَالَ حَدَّثَنَا عَبْدُ الرَّحْمَنِ بْنُ مَهْدِيٍّ، قَالَ حَدَّثَنَا حَمَّادُ بْنُ سَلَمَةَ، عَنْ حَمَّادٍ، عَنْ إِبْرَاهِيمَ، عَنِ الأَسْوَدِ، عَنْ عَائِشَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ رُفِعَ الْقَلَمُ عَنْ ثَلاَثٍ عَنِ النَّائِمِ حَتَّى يَسْتَيْقِظَ وَعَنِ الصَّغِيرِ حَتَّى يَكْبُرَ وَعَنِ الْمَجْنُونِ حَتَّى يَعْقِلَ أَوْ يَفِيقَ ‏" ‏ ‏.‏

sunnah.com