~자마자 (ja-ma-ja) – as soon as, immediately after, right after
~자마자 is an expression to use when you want to say one action happens after the other.
This is almost always only attached to an action verb.
Example: 나 집으로 돌아오자마자 침대에 푹 잤어.
As soon as I returned home, I slept soundly on the bed.
교실로 가자마자 선생님이 나에게 어려운 문제를 물어서 참 돌겠네.
Immediately after going to class, the teacher asked me a tough question so I’m really going crazy.