Examples
Input: [("set", "a", "x", 1), ("set", "a", "y", 4), ("get", "a", 3), ("getRange", "a", 1, 5), ("delete", "a", 6), ("get", "a", 6)]
Expected Output: ["x", [[1, "x"], [4, "y"]], None]
Explanation: At time 3, `a` is `x`. The range [1, 5] shows `a` starting as `x` and changing to `y` at time 4. After deleting at time 6, `get(a, 6)` returns None.
Input: [("set", "a", 10, 1), ("set", "b", 20, 2), ("set", "a", 30, 5), ("get", "a", 5), ("restore", 2), ("get", "a", 5), ("get", "b", 100), ("getRange", "a", 1, 10)]
Expected Output: [30, 10, 20, [[1, 10]]]
Explanation: Before restore, `a` is 30 at time 5. Restoring to time 2 discards the change at time 5, so later queries see `a = 10` and `b = 20`. The only visible history for `a` is its value from time 1.
Input: [("set", "k", "first", 2), ("set", "k", "second", 2), ("delete", "k", 2), ("set", "k", "final", 2), ("get", "k", 2), ("getRange", "k", 1, 3)]
Expected Output: ["final", [[2, "final"]]]
Explanation: All mutations happen at the same timestamp. Input order breaks ties, so the final visible value at time 2 is `final`. The range query collapses same-timestamp mutations into one visible change point.
Input: [("delete", "m", 1), ("get", "m", 1), ("getRange", "m", 1, 3), ("set", "m", "z", 4), ("getRange", "m", 2, 4)]
Expected Output: [None, [], [[4, "z"]]]
Explanation: Deleting a missing key leaves it absent, so `get(m, 1)` is None and there is no visible history in [1, 3]. After setting `m` at time 4, the range [2, 4] shows a single visible change at time 4.
Input: [("set", "a", "red", 1), ("set", "a", "blue", 5), ("set", "a", "blue", 7), ("delete", "a", 9), ("getRange", "a", 3, 10), ("restore", 5), ("get", "a", 10), ("getRange", "a", 6, 10)]
Expected Output: [[[3, "red"], [5, "blue"], [9, None]], "blue", [[6, "blue"]]]
Explanation: From time 3 to 10, `a` starts as `red`, changes to `blue` at 5, stays `blue` at 7, and is deleted at 9. Restoring to 5 discards the later update and delete, so afterwards `a` is still `blue` at time 10.
Input: []
Expected Output: []
Explanation: No operations means no query outputs.