Surah Az-Zumar, ayah 18

39:18

ٱلَّذِينَ يَسۡتَمِعُونَ ٱلۡقَوۡلَ فَيَتَّبِعُونَ أَحۡسَنَهُۥٓۚ أُوْلَٰٓئِكَ ٱلَّذِينَ هَدَىٰهُمُ ٱللَّهُۖ وَأُوْلَٰٓئِكَ هُمۡ أُوْلُواْ ٱلۡأَلۡبَٰبِ ١٨

Alladhīna yastami'ūnal-qawla fayattabi'ūna ahsanahū ulā'ikal-ladhīna hadāhumullāhu wa ulā'ika hum ulul-albāb

Who listen to speech and follow the best of it. Those are the ones Allāh has guided, and those are people of understanding.