Implement a `simulate` function to simulate the queries
Implement a
simulatefunction to simulate the queries