A double-ended queue: push and pop at both the front and the back, all in O(1) amortized. A ring buffer with growth implements it well.
Deque
A double-ended queue: push and pop at both the front and the back, all in O(1) amortized. A ring buffer with growth implements it well.