Given initial elements: $a_0=1,a_1=5,a_2=7,a_3=8,a_4=9,a_5=2$
1) Push all the elements into the stack $S$ in the same order:
2) Push all the elements into the queue $Q$ in the same order:
3) Pop(S):
4) Dequeue(Q):
5) Pop(S):
6) Dequeue (Q):
7) Dequeue (Q) and push the same element into S:
8) repeat step 7 three times we get:
First time:
second time:
third time:
9 ) pop (S):
10 ) pop(S):
from the resultant stack $S$ topmost element is $8$
The correct answer is $8$