SP28306 ADAQUEUE - Ada and Queue

Description

Ada the Ladybug has many things to do. She puts them into her queue. Anyway she is very indecisive, so sometime she uses the top, sometime the back and sometime she decides to reverses it.

Input Format

The first line consists of **1 , number of queries. Each of them contains one of following commands** back - Print number from back and then erase it front - Print number from front and then erase it reverse - Reverses all elements in queue push\_back **N** - Add element **N** to back toFront **N** - Put element **N** to front All numbers will be 0

Output Format

For each back/front query print appropriate number. If you would get this type of query and the queue would be empty, print "**No job for Ada?**" instead.