11979 - Problem F   

Description

Implement a queue of numbers that supports the following operations:

1. print: print the content of the queue, from beginning to end
(use # to specify the end of queue)
2. enqueue: add a number at the end of the queue
3. dequeue: remove a number from the front of the queue
4. delete-mid: remove the item in the middle of the queue, if the queue has odd number of items.
Otherwise, remove the two items in the middle of the queue if the queue has even number of items.  
(Do nothing when the queue is empty)

Assuming we start with an empty queue, our target is to perform a sequence 
of operations specified by the input.

 

 

Input

Each line contains one operation. The input is terminated by end of file. (EOF)

Operations in all cases will be less than 1000.

 

Output

For each print operation, print the content of the queue, from beginning to end. Use # to specify the end of queue. Each number and # should be separated by a blank. Note that there is no blank after #. See the Sample Output below.

Sample Input  Download

Sample Output  Download

Tags




Discuss