#K15931. Queue Operations Simulator

    ID: 24466 Type: Default 1000ms 256MiB

Queue Operations Simulator

Queue Operations Simulator

You are given a set of test cases representing a simulation of a queue operations system. For each test case, you have a list of operations that either enqueue or dequeue elements from a queue. After each operation, print the current state of the queue. If the queue becomes empty, print EMPTY QUEUE.

The operations are described as follows:

  • ENQUEUE x: Insert the integer x into the rear of the queue.
  • DEQUEUE: Remove an element from the front of the queue. If the queue is empty, do nothing except output EMPTY QUEUE.

After each operation, output the elements of the queue separated by a space. If the queue is empty, output EMPTY QUEUE.

Note: For any mathematical expression, use LaTeX format. For example, the length of the queue can be expressed as \(\ell\).

inputFormat

The input is given via standard input (stdin) with the following format:

T
N₁
operation₁
operation₂
... 
operationₙ₁
N₂
operation₁
... 
operationₙ₂
...
N_T
operation₁
... 
operationₙₜ

Here, T is the number of test cases. For each test case, the first line contains an integer Nᵢ, the number of operations, followed by Nᵢ lines each containing an operation.

outputFormat

For each operation in every test case, output a line describing the current state of the queue. If the queue is empty after an operation, output EMPTY QUEUE. The outputs are printed in the order of operations processed.

## sample
3
5
ENQUEUE 10
ENQUEUE 20
DEQUEUE
DEQUEUE
DEQUEUE
3
ENQUEUE 5
ENQUEUE 7
DEQUEUE
4
DEQUEUE
ENQUEUE 15
DEQUEUE
DEQUEUE
10

10 20 20 EMPTY QUEUE EMPTY QUEUE 5 5 7 7 EMPTY QUEUE 15 EMPTY QUEUE EMPTY QUEUE

</p>