How to manage multiple layers in a document and implement undo functionality?
Implement manage_layers(operations). Layers are ordered from bottom to top. Operations are arrays: ["add", id], ["delete", id], ["move", id, index], or ["undo"]. Return the final ordered list of layer IDs. Each mutation is valid, layer IDs are unique, and an undo with no available history does nothing. An undo reverses the most recent mutation only; undo itself is not undoable. Move indices are zero-based.
def manage_layers(operations):