Skip to content
C

Implement Queue

Easyjavapythonccppjavascript

Implement a queue that supports enqueue, dequeue, front and empty operations, processing a stream of operations.

Input Format

The first line contains an integer Q. Each of the next Q lines is one of: enqueue X — add integer X to the back dequeue — remove and return the front element front — return the front element without removing it empty — return whether the queue is empty

Output Format

For each dequeue or front, print the element (or -1 if the queue is empty). For each empty, print 1 if empty, otherwise 0. One value per line.

Input (stdin)

Output

Run your code to see output here...