QUEUESEQ - IITKESO207PA1Q3
In this problem, you will implement a sequence of queues. This means that each element of the sequence will be a queue. The operations are as follows:
1) Enqueue(a, i): Add element a to the front of queue i.
2) Dequeue(i): Dequeue frm Queue i.
3) Is_Empty(i): True if Queue i is empty, false otherwise.
Note: The queue sequence is 1 indexed.
First line contains t: the number of test cases.
The second line contains two space separated integers: n and q denoting the number of elements in the sequeunce and the number of queries respectively. The next q lines contain the queries.
Each query contains two or three space separated integers. Opcodes are: 1 for Enqueue(a, i), 2 for Dequeue(i) and 3 for Is_Empty(i).
If opcode is 1, the query has two more space separated integers a and i denoting the element to be enqueued and the queue respectively.
If opcode is 2 or 3, the query has another space separated integer denoting the queue on which the operation is to be performed.
Enqueue(a, i) should return a.
Dequeue(i) should return the element dequeued. If the queue is empty, print "Empty" (without quotes)
Is_Empty(i) should return True or False depending on whether or not the queue is empty.
1 <= t <= 10
1 <= n <= 100
1 <= q <= 100000
1 <= a <= 10^9
Input: 1 3 5
1 6 2
1 7 3