Abu Huraira reported Allah's Messenger (ﷺ) as saying
There was an argument between Adam and Moses (peace be upon both of them) in the presence of their Lord. Adam came the better of Moses. Moses said: Are you that Adam whom Allah created with His Hand and breathed into himHis sprit, and commanded angels to fall in prostration before him and He made you live in Paradise with comfort and ease. Then you caused the people to get down to the earth because of your lapse. Adam said: Are you that Moses whom Allah selected for His Messengership and for His conversation with him and conferred upon you the tablets, in which everything was clearly explained and granted you the audience in order to have confidential talk with you. What is your opinion, how long Torah would haye been written before I was created? Moses said: Forty years before. Adam said: Did you not see these words: Adam committed an error and he was enticed to (do so). He (Moses) said: Yes. Whereupon, he (Adam) said: Do you then blame me for an act which Allah had ordained for me forty years before He created me? Allah's Messenger (ﷺ) said: This is how Adam came the better of Moses.