#C5227. Queue Operations Simulation

    ID: 48853 Type: Default 1000ms 256MiB

Queue Operations Simulation

Queue Operations Simulation

You are given a series of operations on a queue. Each operation is either of the following:

  • enqueue X: Add the integer X to the end of the queue.
  • dequeue: Remove an element from the front of the queue (if it exists).

After processing all n operations, output the final state of the queue as a space-separated string. If the queue is empty, output Empty Queue.

The underlying idea can be mathematically represented as follows: if we denote the queue after processing the operations as \(Q = [q_1, q_2, \dots, q_k]\), then the result should be:

\[ \text{Result} = \begin{cases} q_1\,q_2,\dots, q_k & \text{if } k > 0, \\ \text{Empty Queue} & \text{if } k = 0. \end{cases} \]

inputFormat

The input is given via stdin in the following format:

  1. An integer n denoting the number of operations.
  2. n lines, each containing either an operation of the form enqueue X or dequeue.

outputFormat

Output the final state of the queue as a single line to stdout. The elements should be space-separated if the queue is not empty. If there are no elements in the queue, output Empty Queue.

## sample
6
enqueue 5
enqueue 3
dequeue
enqueue 7
enqueue 8
dequeue
7 8