e
d
c
b
a
elements in the stack(pile of glasses, LIFO order, last element inserted will be the first to delete ) initially
now 4 elements are popped out in order e d c b
now they are inserted into the queue so now the order of q is e d c b
in the queue, we delete from first element (FIFO in reservation counter who comes first goes first)
now delete 2 elements so e and d are deleted respectively
now insert the elements into stack in the order which they are deleted
so now stack is
d
e
a
now pop one element i.e is d