You maintain a fixed-capacity circular buffer of capacity c that starts empty. You are given n operations, each one of:
PUSH x- insert integerxat the back of the buffer. If the buffer already holdscelements, first drop the oldest element (the one that has been in the buffer the longest) to make room, then insertx.POP- remove the oldest element from the buffer. If the buffer is empty, this operation does nothing.
After processing all n operations in order, print the buffer's contents from oldest to newest, space separated. If the buffer ends up empty, print EMPTY instead.
Input format
Line 1: two integers n and c.
Lines 2..n+1: one operation per line, either PUSH x or POP.
Output format
One line: the final buffer contents oldest-to-newest, space separated, or EMPTY.
Constraints
- 1 <= n <= 100000
- 1 <= c <= 100000
- -1000000 <= x <= 1000000