V-plain + 前に · V-た + 後で · N + の + 前に・後で
before ~ing / after ~ing
The tense is fixed by the pattern, not by when it happened: 前に always takes the *dictionary* form, 後で always takes the *past* form. 寝る前に and 食べた後で, even about yesterday. That fixed pairing is exactly what the exam checks.
寝る前に、歯を磨きます。
ねる まえに、はを みがきます。
I brush my teeth before going to bed.
ご飯を食べた後で、散歩しました。
ごはんを たべた あとで、さんぽしました。
After eating, I went for a walk.