Simulate a bookshelf of fixed width. Over time books are put on the shelf and taken off it; at the end you report the books that remain, listed from left to right.
Each book is identified by a distinct positive integer id $I$ with $0 < I \le 100$, and has an integer width. The shelf processes three kinds of events:
The input contains one or more simulations. A line containing only $-1$ marks the end of the input.
Each simulation starts with a line holding the shelf width $s$ with $5 \le s \le 100$, followed by a sequence of events, one per line:
A, then the book id, then the book width $w$ with $0 < w \le s$.R, then the book id.E.Within an event, each number is preceded by exactly one space.
For each simulation, print one line: the label PROBLEM k: (where $k$ is the simulation number, starting at $1$), followed by the ids of the books remaining on the shelf, from left to right, each preceded by a single space. If the shelf is empty, print only the label.