Phrase pattern
Who → does what → ที่ไหน
ที่ไหน, where, goes where the place itself would be: at the end
who+does what+ที่ไหน
Several rules work together in this pattern: who → does what → what; a question word goes where the answer would be.
Where does the cat sleep?
Where does the child sit?
Where does the son play?
Practice with this pattern changes the words each time. They come from the words you're learning.
Kai says
A Thai tone mark doesn't have one fixed tone of its own. The consonant class helps decide what the same mark does in different syllables.