How do end of turn effects stack? For example, when do I get back a permanent stolen from me compared to the action ability of a Book?

Because both effects happen at the same time, we recommend resolving any effects that benefit players, such as drawing a card from a book, and then at the end returning any stolen permanents.

How do end of turn effects stack? For example, when do I get back a permanent stolen from me compared to the action ability of a Book?