A parcel-sorting conveyor uses a fixed-capacity circular buffer that behaves as a FIFO queue. The buffer can hold at most C parcels at once. You are given Q operations to apply in order, each one of:
ENQUEUE x- if the buffer already holdsCparcels, printFULLand change nothing; otherwise append parcel valuexto the back and printOK.DEQUEUE- if the buffer is empty, printEMPTY; otherwise remove the front parcel and print its value.FRONT- print the value of the front parcel, orEMPTYif the buffer is empty.REAR- print the value of the most recently enqueued parcel still in the buffer, orEMPTYif the buffer is empty.SIZE- print the number of parcels currently in the buffer.
Input format
Line 1: two integers C and Q.
Next Q lines: one operation each, in one of the forms above.
Output format
Print exactly Q lines: the result of each operation, in order.
Constraints
- 1 <= C <= 100000
- 1 <= Q <= 100000
- For
ENQUEUE x: -1000000000 <= x <= 1000000000