Why, when they entered into the ark was the order as follows: first himself and his sons, and after them his wife and his sons' wives, but when they went forth the order was changed, for the sacred historian says, "Noah and his wife went forth, and after them his sons and his sons' wives?"(Genesis 8:18).
Why Noah and His Wife Switched Order Leaving the Ark
The Midrash of Philo 18:1