First, clarify the characteristics of the stack and the queue: the stack is first in last out , and the queue is first in first out ;
Suppose there are two queues, qu1 and qu2;
Now you have a set of numbers [12, 23, 45, 55, 35];
You first enter 12, 23, and 34 into the queue qu2, because the function of the stack is implemented, and now the stack operation is required. The stack is last-in, first-out, so the first to go out is 34;
But now 34 is at the end of the queue, so do you have to move 12 and 34 to the next queue qu1 first, and just pop the remaining 34 of qu2 directly;
Suppose you want to play 23 now, the same principle; (provided that the other queue is empty)
Suppose you pop up 34 and don't pop up 23, but continue to add numbers, then which queue should be added;
Now qu1 has a number, then you will join qu1 (which queue is not empty, join which one);