We all know that:
1. The stack is a data structure that can only push an element from the ending and pop an element from the ending.
2. The queue is a data structure that can only push an element from the ending and pop an element from the beginning.
For example:
1. A stack [1, 2, 3], execute operation push 4, it becomes [1, 2, 3, 4]
2. A stack [1, 2, 3], execute operation pop, it becomes [1, 2]
3. A queue [1, 2, 3], execute operation push 4, it becomes [1, 2, 3, 4]
4. A queue [1, 2, 3], execute operation pop, it becomes [2, 3]
Now, there is an empty sequence, I will give you Q instructions, you should push or pop an element from this sequence which is treated as a stack or a queue. Specially, if popping from an empty sequence, nothing will happen.