When integers join the queue Introduction
A queue is an abstract data type where elements are added to the front (enqueue) and removed from the back (dequeue). This is also known as the FIFO (First In First Out) principle.
It is best shown with an example:


Challenge
Given a non-empty array that contains positive integers and elements that indicate a dequeue (removing an element), output the final list of the queue.
Let's say that X denotes a dequeue in this example. Let's take a look at the following list:
[45, X, X, 37, 20, X, 97, X, 85]

This can be translated to the following queue-pseudo code:
                   Queue
Enqueue 45    -&gt;   45
Dequeue       -&gt;   
Dequeue       -&gt;              (dequeue on an empty queue is a no-op)
Enqueue 37    -&gt;   37
Enqueue 20    -&gt;   20 37
Dequeue       -&gt;   20
Enqueue 97    -&gt;   97 20
Dequeue       -&gt;   97
Enqueue 85    -&gt;   85 97

You can see that in the end, the result is [85, 97], which is the output for this sequence.

Test cases
Note that you may choose any other symbol or character for X, as long as it's not a positive integer.
[1, X, 2, X, 3, X]      -&gt;     []
[1, 2, X]               -&gt;     [2]
[1, 2, 3]               -&gt;     [3, 2, 1]
[1, 2, X, X, X, 3]      -&gt;     [3]
[1, 2, X, 3, X, 4]      -&gt;     [4, 3]

This is code-golf, so the submission with the least amount of bytes wins!
Python 2, 56 53 50 bytes



q=[]
for i in input():q=[[i]+q,q[:i]][i&lt;0]
print q


Try it Online!

Dequeue is -1. This trick allows easy pythonic slicing of the queue.