(Exodus 7:11:) "And the magicians of Egypt also did so with their secret arts." The magicians of Egypt came, "and they each cast down his staff" (ibid. verse 12), just as Aaron had done, "and they became serpents" (ibid.). What is written? "And Aaron's staff swallowed their staffs" (ibid.). Thus (Proverbs 29:11): "A fool gives full vent to his spirit" — this is Pharaoh. "But a wise man holds it back in the end" — this is Moses and Aaron, concerning whom it is written, "And Aaron's staff swallowed their staffs."
Aaron's Staff Swallows the Egyptian Magicians' Serpents
Midrash Tanchuma Buber, Vaera 12:3
ויעשו גם הם חרטומי מצרים וגו' (שמות ז יא), באו חרטומי מצרים וישליכו איש מטהו (שם שם יב) כמה שעה אהרן, ויהיו לתנינים (שם), מה כתיב, ייבלע מטה אהרן את מטותם (שם), הוי כלרוחו יוציא כסיל, זה פרעה, וחכם באחור ישבחנה, זה משה ואהרן שכתוב בהם ויבלע מטה אהרן את מטותם.